Update to 1.3 protocol, sha1 digest still needs work

This commit is contained in:
Ammar Askar committed 2012-09-06 00:48:31 +05:00
1 parent fb7b22b771
commit f18c6496b8
3 files changed
+184 -81

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
import array
def stringToByteArray(string):
return array.array('B', string.decode("hex"))
def TwosCompliment(hash):
hash = array.array('B', hash.decode("hex"))
carry = True
for i in range((hash.__len__() - 1), 0, -1):
if(carry):
carry = hash[i] == 0xFF
hash[i] += 1
return hash
def trimStart(string, character):
for c in string:
if (c == character):
string = string[1:]
else:
break
return string