--- title: "bcrypt generate salt()" slug: "basic-b-crypt-generate-salt" updated: 2026-08-10T08:43:26Z published: 2026-08-10T08:43:26Z canonical: "docs.lobstersoftware.com/basic-b-crypt-generate-salt" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.lobstersoftware.com/llms.txt > Use this file to discover all available pages before exploring further. # bcrypt generate salt() Creates a salt value, which is needed in the function [bcrypt hash password()](/v1/docs/en/basic-b-crypt-hash-password), for example. ## Parameters | Parameter | Description | | --- | --- | | a | The number of hashing rounds to be used when generating the salt value. The higher the value, the more time and difficulty is required for a brute force attack. If the value *0* is specified, the system default value is used. **IMPORTANT:** If the value is generated for the function bcrypt hash password(), *4* to *31* rounds must be used, otherwise an error occurs there. | ## Examples | Parameter a | Result | | --- | --- | | 0 | $2a$10$yzazaE5KTM6o4uK/nt0rce | | 7 | $2a$07$v52PaLDskNhGqZmQMAX9eu |