Skip to content

Instantly share code, notes, and snippets.

@tunelko
Last active January 17, 2018 17:08
Show Gist options
  • Save tunelko/850131e6077573a557706dfd640ca679 to your computer and use it in GitHub Desktop.
Save tunelko/850131e6077573a557706dfd640ca679 to your computer and use it in GitHub Desktop.
mediumRE
#!/usr/bin/env python
"""
mediumRE from
compare algorithm
for ( i = 0; strlen(input) > i && i <= 29; ++i )
{
if ( enc[i] == input[i] * fibo[i] + i )
++cnt;
}
if ( cnt == 30 )
printf(yes);
else
printf(no);
"""
encoded = [0x43, 0x70, 0xDE, 0x138, 0x23E, 0x30D, 0x5EA, 0xA09, 0x46A, 0x12BA, 0x2327, 0x3CCB, 0x6258, 0x8BF4, 0xEE56, 0x1AC04, 0x2AE46, 0x3FB89, 0x21B07, 0x8ABD7, 0x115EE4, 0x1C605C, 0x324959, 0x33A637, 0x83A6BB, 0x81A97F, 0x143AFF2, 0x1D664AE, 0x32830EF, 0x1A2F745]
fibo = [0x01 ,0x01 , 0x02 , 0x03 , 0x05 , 0x08 , 0x0D , 0x15 , 0x22 , 0x37 , 0x59 , 0x90 , 0xE9 , 0x179 , 0x262 , 0x3DB , 0x63D , 0xA18 , 0x1055 , 0x1A6D , 0x2AC2 , 0x452F , 0x6FF1 , 0xB520 , 0x12511 , 0x1DA31 , 0x2FF42 , 0x4D973 , 0x7D8B5 , 0xCB228]
i=-1
flag =''
for enc in encoded:
i = i + 1
flag =''.join(chr((enc - i )/fibo[i]))
print flag
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment