Files
herolib/aiprompts/v_core/crypto/bcrypt.md
2025-09-02 07:28:13 +02:00

1.8 KiB

module bcrypt

Contents

Constants

const min_cost = 4

[Return to contents]

const max_cost = 31

[Return to contents]

const default_cost = 10

[Return to contents]

const salt_length = 16

[Return to contents]

const max_crypted_hash_size = 23

[Return to contents]

const encoded_salt_size = 22

[Return to contents]

const encoded_hash_size = 31

[Return to contents]

const min_hash_size = 59

[Return to contents]

const major_version = '2'

[Return to contents]

const minor_version = 'a'

[Return to contents]

compare_hash_and_password

fn compare_hash_and_password(password []u8, hashed_password []u8) !

compare_hash_and_password compares a bcrypt hashed password with its possible hashed version.

[Return to contents]

generate_from_password

fn generate_from_password(password []u8, cost int) !string

generate_from_password return a bcrypt string from Hashed struct.

[Return to contents]

generate_salt

fn generate_salt() string

generate_salt generate a string to be treated as a salt.

[Return to contents]

Hashed

struct Hashed {
mut:
	hash  []u8
	salt  []u8
	cost  int
	major string
	minor string
}

[Return to contents]

free

fn (mut h Hashed) free()

free the resources taken by the Hashed h

[Return to contents]

Powered by vdoc. Generated on: 2 Sep 2025 07:18:17