Thanks to visit codestin.com
Credit goes to github.com

Skip to content

HMAC-based Extract-and-Expand Key Derivation Function (HKDF) in pure V Language

License

Notifications You must be signed in to change notification settings

blackshirt/hkdf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hkdf

HMAC-based Extract-and-Expand Key Derivation Function (HKDF) in pure V Language. See RFC 5869 for more detail.

Contents

new

new creates a new instance of Hkdf with hash h

fn new(h crypto.Hash) &Hkdf

expand

expand expands pseudorandom key to build output keying material using underlying crypto.Hash prk was a pseudorandom key of at least HashLen octets (usually, the output from the extract step) info is optional context and application specific information (can be a zero-length string)

pub fn expand(h crypto.Hash, prk []u8, info []u8, length int) ![]u8

extract

extract generates a pseudorandom key for use with Expand from an input secret and an optional independent salt.

pub fn extract(h crypto.Hash, salt []u8, ikm []u8) ![]u8

[Return to contents]

Hkdf

hasher

fn (k Hkdf) hasher() crypto.Hash

[Return to contents]

sum

fn (k Hkdf) sum(data []u8) ![]u8

sum return sum of the data for Hkdf hash

[Return to contents]

size

fn (k Hkdf) size() !int

size return size of the checksum underlying hash

[Return to contents]

hmac

fn (k Hkdf) hmac(key []u8, data []u8) ![]u8

hmac create new hmac

[Return to contents]

extract

fn (k Hkdf) extract(salt []u8, ikm []u8) ![]u8

extract create pseudorandom key (prk) from input given.
its output is hmac based hash with length (size) of Hashing checksum size

[Return to contents]

expand

fn (k Hkdf) expand(prk []u8, info []u8, length int) ![]u8

// expand expand pseudorandom key to build output keying materi.
where length is the length of output keying material in octets (<= 255*HashLen) where HashLen denotes the length of the hash function output in octets

[Return to contents]

About

HMAC-based Extract-and-Expand Key Derivation Function (HKDF) in pure V Language

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published