Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions lib/rocra.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,38 +65,38 @@ def generate(ocra_suite, key, counter, question, password, session_information,

# Password
if dataInput.include?("psha1")
password = password.ljust(40, '0')
password = password.rjust(40, '0')
password_length = 20
end

if dataInput.include?("psha256")
password = password.ljust(64, '0')
password = password.rjust(64, '0')
password_length = 32
end

if dataInput.include?("psha512")
password = password.ljust(128, '0')
password = password.rjust(128, '0')
password_length = 64
end

# session_information
if dataInput.include?("s064")
session_information = session_information.ljust(128, '0')
session_information = session_information.rjust(128, '0')
session_information_length = 64
end

if dataInput.include?("s128")
session_information = session_information.ljust(256, '0')
session_information = session_information.rjust(256, '0')
session_information_length = 128
end

if dataInput.include?("s256")
session_information = session_information.ljust(512, '0')
session_information = session_information.rjust(512, '0')
session_information_length = 256
end

if dataInput.include?("s512")
session_information = session_information.ljust(128, '0')
session_information = session_information.rjust(128, '0')
session_information_length = 64
end

Expand Down Expand Up @@ -195,7 +195,7 @@ def oath_truncate(hash, length = 6)
# @param String text the message or text to be authenticated.
#
def hmac_sha1(crypto, keyBytes, text)
digest = OpenSSL::Digest::Digest.new(crypto)
digest = OpenSSL::Digest.new(crypto)
str2hex(OpenSSL::HMAC.digest(digest, keyBytes, text))
end

Expand Down
2 changes: 1 addition & 1 deletion lib/rocra/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
class Rocra
VERSION = "0.0.1"
VERSION = "0.0.2"
end