solatis / haskell-base32string

Typesafe base32 string representation according to RFC 4648
MIT License
2 stars 0 forks source link

This package does not implement RFC 4648. #1

Open enzoh opened 8 years ago

enzoh commented 8 years ago

I was using this package in production to encode multi-factor authentication secrets when I found that some secrets (~1 in 50) were rejected by the Google Authenticator mobile application. I isolated the problem to this package, which does not implement RFC 4648. See this example:

Data.Base32String.Default.fromBytes $ Data.ByteString.pack [3,119,161,34,34,2,193,35,22,151] "N32CIRCALASGFUX"

The correct result is: "AN32CIRCALASGFUX"

MaxGabriel commented 6 years ago

For anyone who runs into this, I recommend using the memory package. There's an example of using it to implement 2FA here: https://github.com/haskell-crypto/cryptonite/pull/222/files