{"action":"closed","issue":{"url":"https://api.github.com/repos/mdp/rotp/issues/39","labels_url":"https://api.github.com/repos/mdp/rotp/issues/39/labels{/name}","comments_url":"https://api.github.com/repos/mdp/rotp/issues/39/comments","events_url":"https://api.github.com/repos/mdp/rotp/issues/39/events","html_url":"https://github.com/mdp/rotp/issues/39","id":55934133,"number":39,"title":"Base32 decode","user":{"login":"braindev","id":16224,"avatar_url":"https://avatars.githubusercontent.com/u/16224?v=3","gravatar_id":"","url":"https://api.github.com/users/braindev","html_url":"https://github.com/braindev","followers_url":"https://api.github.com/users/braindev/followers","following_url":"https://api.github.com/users/braindev/following{/other_user}","gists_url":"https://api.github.com/users/braindev/gists{/gist_id}","starred_url":"https://api.github.com/users/braindev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/braindev/subscriptions","organizations_url":"https://api.github.com/users/braindev/orgs","repos_url":"https://api.github.com/users/braindev/repos","events_url":"https://api.github.com/users/braindev/events{/privacy}","received_events_url":"https://api.github.com/users/braindev/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-01-29T17:59:58Z","updated_at":"2015-01-29T18:17:04Z","closed_at":"2015-01-29T18:17:04Z","body":"Why doesn't the Base32 decode function handle padding?\r\n\r\nThis doesn't work:\r\n\r\n```\r\n2.2.0 :012 > totp = ROTP::TOTP.new Base32.encode(\"dntqoaxas7rvtfuf\")\r\n => #<ROTP::TOTP:0x007fdd4d062458 @interval=30, @issuer=nil, @digits=6, @digest=\"sha1\", @secret=\"MRXHI4LPMF4GC4ZXOJ3HIZTVMY======\">\r\n2.2.0 :013 > totp.now\r\nROTP::Base32::Base32Error: Invalid Base32 Character - '='\r\n\tfrom /Users/bjohnson/.rvm/gems/ruby-2.2.0/gems/rotp-2.1.0/lib/rotp/base32.rb:43:in `decode_quint'\r\n\tfrom /Users/bjohnson/.rvm/gems/ruby-2.2.0/gems/rotp-2.1.0/lib/rotp/base32.rb:28:in `block in decode_block'\r\n\tfrom /Users/bjohnson/.rvm/gems/ruby-2.2.0/gems/rotp-2.1.0/lib/rotp/base32.rb:28:in `each_char'\r\n\tfrom /Users/bjohnson/.rvm/gems/ruby-2.2.0/gems/rotp-2.1.0/lib/rotp/base32.rb:28:in `each'\r\n\tfrom /Users/bjohnson/.rvm/gems/ruby-2.2.0/gems/rotp-2.1.0/lib/rotp/base32.rb:28:in `map'\r\n\tfrom /Users/bjohnson/.rvm/gems/ruby-2.2.0/gems/rotp-2.1.0/lib/rotp/base32.rb:28:in `decode_block'\r\n\tfrom /Users/bjohnson/.rvm/gems/ruby-2.2.0/gems/rotp-2.1.0/lib/rotp/base32.rb:10:in `block in decode'\r\n\tfrom /Users/bjohnson/.rvm/gems/ruby-2.2.0/gems/rotp-2.1.0/lib/rotp/base32.rb:9:in `each'\r\n\tfrom /Users/bjohnson/.rvm/gems/ruby-2.2.0/gems/rotp-2.1.0/lib/rotp/base32.rb:9:in `decode'\r\n\tfrom /Users/bjohnson/.rvm/gems/ruby-2.2.0/gems/rotp-2.1.0/lib/rotp/otp.rb:52:in `byte_secret'\r\n\tfrom /Users/bjohnson/.rvm/gems/ruby-2.2.0/gems/rotp-2.1.0/lib/rotp/otp.rb:26:in `generate_otp'\r\n\tfrom /Users/bjohnson/.rvm/gems/ruby-2.2.0/gems/rotp-2.1.0/lib/rotp/totp.rb:29:in `now'\r\n```\r\n\r\nBut this works?\r\n\r\n```\r\n2.2.0 :014 > totp = ROTP::TOTP.new Base32.encode(\"dntqoaxas7rvtfuf\").gsub(/=/, '')\r\n => #<ROTP::TOTP:0x007fdd4d045268 @interval=30, @issuer=nil, @digits=6, @digest=\"sha1\", @secret=\"MRXHI4LPMF4GC4ZXOJ3HIZTVMY\">\r\n2.2.0 :015 > totp.now\r\n => \"907944\"\r\n```\r\n\r\nP.S.\r\n\r\nWhy is the Base32 decode hand rolled?  Why not use the standard library?\r\n\r\nThanks!"}}