Add last night's progress.

Basic functionality for HOTP, TOTP, and YubiKey OTP. Still need YubiKey
HMAC, serialisation, check, and scan.
This commit is contained in:
Kyle Isom
2013-12-20 17:00:01 -07:00
parent 1dec15fd11
commit 0982f47ce3
9 changed files with 386 additions and 29 deletions

29
modhex/example_test.go Normal file
View File

@@ -0,0 +1,29 @@
package modhex
import (
"fmt"
"github.com/gokyle/twofactor/modhex"
)
var out = "fjhghrhrhvdrdciihvidhrhfdb"
var in = "Hello, world!"
func ExampleEncoding_EncodeToString() {
data := []byte("Hello, world!")
str := modhex.StdEncoding.EncodeToString(data)
fmt.Println(str)
// Output:
// fjhghrhrhvdrdciihvidhrhfdb
}
func ExampleEncoding_DecodeString() {
str := "fjhghrhrhvdrdciihvidhrhfdb"
data, err := modhex.StdEncoding.DecodeString(str)
if err != nil {
fmt.Printf("%v\n", err)
return
}
fmt.Printf("%s", string(data))
// Output:
// Hello, world!
}