# module sha256 ## Contents - [Constants](#Constants) - [hexhash](#hexhash) - [hexhash_224](#hexhash_224) - [new](#new) - [new224](#new224) - [sum](#sum) - [sum224](#sum224) - [sum256](#sum256) - [Digest](#Digest) - [free](#free) - [reset](#reset) - [write](#write) - [sum](#sum) - [size](#size) - [block_size](#block_size) ## Constants ```v const size = 32 ``` The size of a SHA256 checksum in bytes. [[Return to contents]](#Contents) ```v const size224 = 28 ``` The size of a SHA224 checksum in bytes. [[Return to contents]](#Contents) ```v const block_size = 64 ``` The blocksize of SHA256 and SHA224 in bytes. [[Return to contents]](#Contents) ## hexhash ```v fn hexhash(s string) string ``` hexhash returns a hexadecimal SHA256 hash sum `string` of `s`. Example ```v assert sha256.hexhash('V') == 'de5a6f78116eca62d7fc5ce159d23ae6b889b365a1739ad2cf36f925a140d0cc' ``` [[Return to contents]](#Contents) ## hexhash_224 ```v fn hexhash_224(s string) string ``` hexhash_224 returns a hexadecimal SHA224 hash sum `string` of `s`. [[Return to contents]](#Contents) ## new ```v fn new() &Digest ``` new returns a new Digest (implementing hash.Hash) computing the SHA256 checksum. [[Return to contents]](#Contents) ## new224 ```v fn new224() &Digest ``` new224 returns a new Digest (implementing hash.Hash) computing the SHA224 checksum. [[Return to contents]](#Contents) ## sum ```v fn sum(data []u8) []u8 ``` sum returns the SHA256 checksum of the bytes in `data`. Example ```v assert sha256.sum('V'.bytes()).len > 0 == true ``` [[Return to contents]](#Contents) ## sum224 ```v fn sum224(data []u8) []u8 ``` sum224 returns the SHA224 checksum of the data. [[Return to contents]](#Contents) ## sum256 ```v fn sum256(data []u8) []u8 ``` sum256 returns the SHA256 checksum of the data. [[Return to contents]](#Contents) ## Digest ## free ```v fn (mut d Digest) free() ``` free the resources taken by the Digest `d` [[Return to contents]](#Contents) ## reset ```v fn (mut d Digest) reset() ``` reset the state of the Digest `d` [[Return to contents]](#Contents) ## write ```v fn (mut d Digest) write(p_ []u8) !int ``` write writes the contents of `p_` to the internal hash representation. [[Return to contents]](#Contents) ## sum ```v fn (d &Digest) sum(b_in []u8) []u8 ``` sum returns the SHA256 or SHA224 checksum of digest with the data. [[Return to contents]](#Contents) ## size ```v fn (d &Digest) size() int ``` size returns the size of the checksum in bytes. [[Return to contents]](#Contents) ## block_size ```v fn (d &Digest) block_size() int ``` block_size returns the block size of the checksum in bytes. [[Return to contents]](#Contents) #### Powered by vdoc. Generated on: 2 Sep 2025 07:18:17