private byte[] OtaGenChunkHash(byte[] buf, int offset, int len) { byte[] hash = new byte[20]; OtaUpdateKeyBuffer(); Sodium.ss_sha1_hmac_ex(_otaChunkKeyBuffer, (uint)_otaChunkKeyBuffer.Length, buf, offset, (uint)len, hash); return(hash); }
protected byte[] genHash(byte[] buf, int offset, int len) { byte[] hash = new byte[20]; updateKeyBuffer(); Sodium.ss_sha1_hmac_ex(_keyBuffer, (uint)_keyBuffer.Length, buf, offset, (uint)len, hash); return(hash); }
private byte[] OtaGenHash(byte[] msg, int msg_len) { byte[] auth = new byte[ONETIMEAUTH_BYTES]; byte[] hash = new byte[20]; byte[] auth_key = new byte[MAX_IV_LENGTH + MAX_KEY_LENGTH]; Buffer.BlockCopy(_encryptIV, 0, auth_key, 0, ivLen); Buffer.BlockCopy(_key, 0, auth_key, ivLen, keyLen); Sodium.ss_sha1_hmac_ex(auth_key, (uint)(ivLen + keyLen), msg, 0, (uint)msg_len, hash); Buffer.BlockCopy(hash, 0, auth, 0, ONETIMEAUTH_BYTES); return(auth); }