Module crypto.bcrypt stdlib

crypto.bcrypt
Version:
0.3.3
License:
MIT
Dependencies from vmod:
0
Imports:
3
Imported by:
0
Repository:
OS-specific
Show selected OS-specific symbols.
Backend-specific
Show selected Backend-specific symbols.

Dependencies defined in v.mod

This section is empty.

Imports

Imported by

This section is empty.

Aliases

This section is empty.

Constants

#constant min_cost

min_cost              = 4

#constant max_cost

max_cost              = 31

#constant default_cost

default_cost          = 10

#constant salt_length

salt_length           = 16

#constant max_crypted_hash_size

max_crypted_hash_size = 23

#constant encoded_salt_size

encoded_salt_size     = 22

#constant encoded_hash_size

encoded_hash_size     = 31

#constant min_hash_size

min_hash_size         = 59

#constant major_version

major_version         = '2'

#constant minor_version

minor_version         = 'a'

Sum types

This section is empty.

Functions

#fn 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.

#fn generate_from_password

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

generate_from_password return a bcrypt string from Hashed struct.

#fn generate_salt

fn generate_salt() string

generate_salt generate a string to be treated as a salt.

Structs

#struct Hashed

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

#fn (&Hashed) free

unsafe
fn (mut h &Hashed) free()

free the resources taken by the Hashed h

#fn (&Hashed) hash_u8

fn (mut h &Hashed) hash_u8() []u8

hash_byte converts the hash value to a byte array.

#fn (&Hashed) decode_version

fn (mut h &Hashed) decode_version(sbytes []u8) !int

decode_version decode bcrypt version.

#fn (&Hashed) decode_cost

fn (mut h &Hashed) decode_cost(sbytes []u8) !int

decode_cost extracts the value of cost and returns the next index in the array.

Interfaces

This section is empty.

Enums

This section is empty.