Created
May 10, 2010 14:39
-
-
Save jeedee/396104 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
KEY = ['4E', '65', '78', '6F', '6E', '49', '6E', '63', '2E'] | |
def self.decrypt(packet, increment) | |
0.upto(packet.length-1) do |i| | |
packet[i] = (packet[i] ^ (KEY[i % 9].hex)) | |
packet[i] = (packet[i] ^ (i/9) ) | |
packet[i] = (packet[i] ^ increment) | |
end | |
#todo optimize conversion | |
return packet.map {|x| x.to_s(16).hex.chr}.join |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment