From 0e61bba15ab17d12124e0a1cd84b02e68e8e8bd5 Mon Sep 17 00:00:00 2001 From: David Bourguignon Date: Mon, 30 Jan 2012 00:39:50 -0800 Subject: [PATCH] Merge pull request #3 from bgarret/ruby-1.9.2 Ruby 1.9 support --- lib/paiement_cic.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/paiement_cic.rb b/lib/paiement_cic.rb index 90c5af5..8dbf7b1 100644 --- a/lib/paiement_cic.rb +++ b/lib/paiement_cic.rb @@ -8,7 +8,7 @@ class String unless other.kind_of? String raise ArgumentError, "Can't bitwise-XOR strings of different length" \ unless self.length == other.length - result = (0..self.length-1).collect { |i| self[i] ^ other[i] } + result = (0..self.length-1).collect { |i| self[i].ord ^ other[i].ord } result.pack("C*") end end @@ -99,7 +99,7 @@ class PaiementCic hex_string_key = payement.hmac_key[0..37] hex_final = payement.hmac_key[38..40] + "00"; - cca0 = hex_final[0] + cca0 = hex_final[0].ord if cca0 > 70 && cca0 < 97 hex_string_key += (cca0 - 23).chr + hex_final[1..2]