///|
/// HMAC block size for SHA-384/512 is 128 bytes.
let hmac_block_size_512 : Int = 128
///|
/// Compute HMAC-SHA512 (RFC 2104) and return raw 64-byte digest.
pub fn hmac_sha512(key : Bytes, message : Bytes) -> Bytes {
let actual_key = if key.length() > hmac_block_size_512 {
sha512(key)
} else {
key
}
let k : Array[Byte] = actual_key.to_array()
while k.length() < hmac_block_size_512 {
k.push(b'\x00')
}
let key_bytes = Bytes::from_array(k)
let ipad : Array[Byte] = Array::make(hmac_block_size_512, b'\x00')
let opad : Array[Byte] = Array::make(hmac_block_size_512, b'\x00')
for i in 0.. Bytes {
let actual_key = if key.length() > hmac_block_size_512 {
sha384(key)
} else {
key
}
let k : Array[Byte] = actual_key.to_array()
while k.length() < hmac_block_size_512 {
k.push(b'\x00')
}
let key_bytes = Bytes::from_array(k)
let ipad : Array[Byte] = Array::make(hmac_block_size_512, b'\x00')
let opad : Array[Byte] = Array::make(hmac_block_size_512, b'\x00')
for i in 0..