Documentation
¶
Index ¶
Examples ¶
Constants ¶
const BlockSize = 64
BlockSize is the size of an MD4 block measured in bytes.
The size of an MD4 block 64 bytes (i.e., 512 bits).
const Size = 16
Size is the size of an MD4 digest (checksum) measured in bytes.
The size of an MD4 digest 16 bytes (i.e., 128 bits). For example:
// 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 [16]byte{0x31,0xd6,0xcf,0xe0,0xd1,0x6a,0xe9,0x31,0xb7,0x3c,0x59,0xd7,0xe0,0xc0,0x89,0xc0}
Note that if you are representing an MD4 digest in hexadecimal, then it will double the number of characters to 32 bytes. For example:
"31d6cfe0d16ae931b73c59d7e0c089c0"
Or, if you include the "0x" prefix in front of the hexadecimal representation, then it will be 32+2=34 bytes long:
0x31d6cfe0d16ae931b73c59d7e0c089c0
Size represents the length of the MD4 digest in a binary representation.
Variables ¶
This section is empty.
Functions ¶
func New ¶
New returns a hash.Hash that calculates an MD4 digest (checksum) using the MD4 cryptographic hash-function.
Example ¶
hasher := md4.New() // “Yesterday I was clever, so I wanted to change the world. Today I am wise, so I am changing myself.” // ⸺ Rumi io.WriteString(hasher, "“") io.WriteString(hasher, "Yesterday I was clever, so I wanted to change the world.") io.WriteString(hasher, " ") io.WriteString(hasher, "Today I am wise, so I am changing myself.") io.WriteString(hasher, "”") io.WriteString(hasher, "\n") io.WriteString(hasher, "”") io.WriteString(hasher, "⸺") io.WriteString(hasher, " ") io.WriteString(hasher, "Rumi") digest := hasher.Sum(nil) fmt.Printf("MD4-DIGEST: 0x%032X\n", digest)
Output: MD4-DIGEST: 0xA2D6BDF512B93A4DAD4556D8F9495E5B
Types ¶
This section is empty.