Skip to content

Instantly share code, notes, and snippets.

View Tony-Stark's full-sized avatar
zap

Tony Stark Tony-Stark

zap
View GitHub Profile
cipherText = [156, 248, 193, 197, 246, 10, 192 ,223, 200, 5, 10, 237, 223, 241, 10, 197, 248, 193, 10, 246, 194, 193, 10, 53, 59, 59, 55, 193, 251, 246, 10, 194, 197, 203, 195, 193, 248, 10, 223, 196, 10, 197, 222, 222, 10, 246, 221, 217, 193, 251, 5, 10, 150, 194, 193, 10, 250, 197, 251, 251, 247, 223, 248, 198, 10, 196, 223, 248, 10, 246, 194, 221, 251, 10, 251, 246, 197, 199, 193, 10, 221, 251, 48, 250, 243, 46, 11, 122, 118, 43, 108, 127, 43, 120, 112, 43, 84, 50, 120, 94, 139, 167, 177, 178, 163, 176, 94, 174, 176, 173, 165, 176, 159, 171, 171, 163, 176, 101, 108, 94, 140, 173, 181, 94, 165, 173, 94, 96, 95, 17, 82, 95, 85, 17, 67, 74, 78, 73, 63, 8, 63, 73, 51, 54]
key = [[0,45,87], [1,172,40], [2,7,40], [1,24,48], [1,75,100], [0,82,82], [2,2,64], [0,55,33]]
ctLength = cipherText.length
cursor = 0
dir = 1
key.each do |sub|
sub[2].times do
case sub[0]
when 0
@Tony-Stark
Tony-Stark / rubydecipher
Created May 1, 2017 19:28
Ruby code, doesn't run, think the problem is with the limits of the array, but not sure where or how to solve it.
# your code goes here
cipherText=[156, 248, 193, 197, 246, 10, 192 ,223, 200, 5, 10, 237, 223, 241, 10, 197, 248, 193, 10, 246, 194, 193, 10, 53, 59, 59, 55, 193, 251, 246, 10, 194, 197, 203, 195, 193, 248, 10, 223, 196, 10, 197, 222, 222, 10, 246, 221, 217, 193, 251, 5, 10, 150, 194, 193, 10, 250, 197, 251, 251, 247, 223, 248, 198, 10, 196, 223, 248, 10, 246, 194, 221, 251, 10, 251, 246, 197, 199, 193, 10, 221, 251, 48, 250, 243, 46, 11, 122, 118, 43, 108, 127, 43, 120, 112, 43, 84, 50, 120, 94, 139, 167, 177, 178, 163, 176, 94, 174, 176, 173, 165, 176, 159, 171, 171, 163, 176, 101, 108, 94, 140, 173, 181, 94, 165, 173, 94, 96, 95, 17, 82, 95, 85, 17, 67, 74, 78, 73, 63, 8, 63, 73, 51, 54]
key=[[0,45,87], [1,172,40], [2,7,40], [1,24,48], [1,75,100], [0,82,82], [2,2,64], [0,55,33]]
ctLength=cipherText.length
cursor=0
dir=1
key.each do |sub|
sub[2].times do
case sub[0]