otpcli/t/0002-RFC-6238-SHA-256-Test-Vectors.t
Lucas 2fe090286d Rework tests
Split along multiple files, produce TAP output, rely on Perl's prove for
running them. Improves clarity and hopefully makes it easier to add new
tests in the future.
2021-02-12 22:58:09 +00:00

21 lines
701 B
Bash

#!/bin/sh
[ -n "${0%/*}" ] && cd "${0%/*}"
. ./lib.sh
if [ ! -x ../otpcli ]; then
plan 0 "skip: build otpcli first"
exit 1
fi
plan 6
# base32("12345678901234567890123456789012")
key=GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQGEZA
check "time 59" 46119246 ../otpcli -d 8 -a sha256 -T 59 "$key"
check "time 1111111109" 68084774 ../otpcli -d 8 -a sha256 -T 1111111109 "$key"
check "time 1111111111" 67062674 ../otpcli -d 8 -a sha256 -T 1111111111 "$key"
check "time 1234567890" 91819424 ../otpcli -d 8 -a sha256 -T 1234567890 "$key"
check "time 2000000000" 90698825 ../otpcli -d 8 -a sha256 -T 2000000000 "$key"
check "time 20000000000" 77737706 ../otpcli -d 8 -a sha256 -T 20000000000 "$key"