MCPcopy Create free account
hub / github.com/authorizerdev/authorizer / TestHashOTP_Deterministic

Function TestHashOTP_Deterministic

internal/crypto/otp_test.go:29–38  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

27}
28
29func TestHashOTP_Deterministic(t *testing.T) {
30 // Same plaintext + same key must produce the same digest. Otherwise
31 // VerifyOTPHash could not work — there is no random nonce as in AES.
32 const key = "k"
33 const plain = "999000"
34
35 a := HashOTP(plain, key)
36 b := HashOTP(plain, key)
37 assert.Equal(t, a, b)
38}
39
40func TestVerifyOTPHash_WrongPlaintext(t *testing.T) {
41 const key = "k"

Callers

nothing calls this directly

Calls 1

HashOTPFunction · 0.85

Tested by

no test coverage detected