Created
December 7, 2015 16:31
-
-
Save idzuna/ca1977d07cfdbffdaf1c to your computer and use it in GitHub Desktop.
SECCON 2015 の Reverse Engineering Hardare 2 の回路を再現した
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
#include <fstream> | |
static unsigned char setValue( unsigned char value ) | |
{ | |
unsigned char v = value + 3; | |
if ( ( v & 0x0f ) == 0x0f ) | |
v += 0x10; | |
return | |
( ( v & 0xfe ) >> 1 ) | | |
( ( v & 0x01 ) << 7 ); | |
} | |
int main() | |
{ | |
const unsigned char encrypted[] = | |
{ | |
0x1F,0x0A,0x4A,0xAA,0xCE,0x3C,0xAD,0xAA,0x87,0x46,0x42,0xFF,0x2A,0x40,0x15,0x07, | |
0x46,0x01,0x73,0xDC,0x00,0x2E,0x79,0x4B,0x5F,0x61,0x7E,0x9D,0x3A,0xDA,0x2F,0xD8, | |
0x6F,0x66,0x5E,0x1A,0x14,0x18,0x55,0x7D,0x93,0xC2,0x64,0x79,0xA4,0x72,0x95,0x40, | |
0xB6,0xE5,0x21,0x3E,0x88,0xB7,0xCE,0xE1,0x78,0x4D,0x29,0x60,0x75,0x59,0xDD,0x1C, | |
0x9C,0xD7,0x6D | |
}; | |
unsigned char a = 0; | |
std::ofstream out( "out.bin" , std::ios::out | std::ios::binary ); | |
for ( auto v : encrypted ) | |
{ | |
out << static_cast<char>( v ^ a ); | |
a = setValue(a); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment