(t *testing.T)
| 27 | } |
| 28 | |
| 29 | func 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 | |
| 40 | func TestVerifyOTPHash_WrongPlaintext(t *testing.T) { |
| 41 | const key = "k" |