diff options
| author | zhibog <zhibog-github@web.de> | 2021-12-31 13:16:11 +0100 |
|---|---|---|
| committer | zhibog <zhibog-github@web.de> | 2021-12-31 13:16:11 +0100 |
| commit | 42033ea808ae3b97d909f538e422e63dadfd8f6c (patch) | |
| tree | 3cf160b2a303842382f4d9aa6f59f78c3ae19685 /core/crypto/README.md | |
| parent | c7ff296bef1b51004cfee2470d5d95abe391dabe (diff) | |
Extended crypto API by variants that write the result into a destination buffer, instead of returning it
Diffstat (limited to 'core/crypto/README.md')
| -rw-r--r-- | core/crypto/README.md | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/core/crypto/README.md b/core/crypto/README.md index 5955f9c56..ddcb12d81 100644 --- a/core/crypto/README.md +++ b/core/crypto/README.md @@ -32,9 +32,11 @@ Please see the chart below for the options. #### High level API Each hash algorithm contains a procedure group named `hash`, or if the algorithm provides more than one digest size `hash_<size>`\*. -Included in these groups are four procedures. +Included in these groups are six procedures. * `hash_string` - Hash a given string and return the computed hash. Just calls `hash_bytes` internally * `hash_bytes` - Hash a given byte slice and return the computed hash +* `hash_string_to_buffer` - Hash a given string and put the computed hash in the second proc parameter. Just calls `hash_bytes_to_buffer` internally +* `hash_bytes_to_buffer` - Hash a given string and put the computed hash in the second proc parameter. The destination buffer has to be at least as big as the digest size of the hash * `hash_stream` - Takes a stream from io.Stream and returns the computed hash from it * `hash_file` - Takes a file handle and returns the computed hash from it. A second optional boolean parameter controls if the file is streamed (this is the default) or read at once (set to true) @@ -59,6 +61,10 @@ main :: proc() { // Compute the hash, using the high level API computed_hash := md4.hash(input) + // Variant that takes a destination buffer, instead of returning the computed hash + hash := make([]byte, md4.DIGEST_SIZE) // @note: Destination buffer has to be at least as big as the digest size of the hash + md4.hash(input, hash[:]) + // Compute the hash, using the low level API ctx: md4.Md4_Context computed_hash_low: [16]byte |