Name: Anonymous 2010-12-13 23:04
Ok guys this is what I'm trying to do:
The username and password used for this example is sa/password.
The algorithm to encrypt the password is simply to expand every byte of the password to 2 bytes, swap the higher and lower 4 bits within each byte, xor each byte with A5. For example to encrypt the character "p":
(ASCII is 70 hex):
70 is expanded to 70 00
After the swap the result is: 07 00
XOR with A5: A2 A5
Hence to decrypt it, we will take the odd bytes, XOR with A5, and swap the higher and lower 4 bits.
Take A2
XOR with A5: A2 XOR A5 = 07
Swap: 7 becomes 70.
Hope that explains that, here is how I'm trying to do it.
The username and password used for this example is sa/password.
The algorithm to encrypt the password is simply to expand every byte of the password to 2 bytes, swap the higher and lower 4 bits within each byte, xor each byte with A5. For example to encrypt the character "p":
(ASCII is 70 hex):
70 is expanded to 70 00
After the swap the result is: 07 00
XOR with A5: A2 A5
Hence to decrypt it, we will take the odd bytes, XOR with A5, and swap the higher and lower 4 bits.
Take A2
XOR with A5: A2 XOR A5 = 07
Swap: 7 becomes 70.
Hope that explains that, here is how I'm trying to do it.
sList = []
def main():
#Get every byte of password and load it into a linked list, drop the odd numbered bytes (should be A5)
password = ENCRYPTED()
dropA5Bytes(password)
xorThroughList(password, "a5") #the input password data and A5 converted to decimal
#XOR with A5
reverseListItems(password)#
#Reverse the order of each item in linked list
printLinkedList(password)#
#Print linked list
#
#Convert linked list contents into text
convertLinkedPassword(password)
#Print linked list
printLinkedList(password)
def dropA5Bytes(sList):
while (sList.count("a5") != 0):
sList.remove("a5")
def xorThroughList(sList, key):
for i in range(len(sList) - 1):
sList[i] = str(int(sList[i], 16) ^ int(key,16)).zfill(2)
def reverseListItems(sList):
for i in range(len(sList) - 1):
sList[i] = sList[i][1] + sList[i][0]
def printLinkedList(password):
print(password)
def convertLinkedPassword(password):
for i in range(len(sList) - 1):
sList[i] = chr(int(sList[i],16))
def ENCRYPTED():
return ["b1","a5","93","a5","e2","a5","f6","a5","c6","a5","b6","a5","11","a5","f3","a5","32","a5","4d"]
main()