This file contains hidden or 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
[0, 0, 2, 1, 1, 1, 1, 2, 1] | |
[1, 2, 1, 1, 0, 0, 2, 1, 1] | |
[2, 0, 2, 1, 0, 2, 0, 0, 2] | |
[2, 0, 2, 1, 0, 0, 2, 1, 1] | |
[0, 2, 1, 0, 0, 2, 2, 1, 1] | |
[1, 1, 2, 1, 0, 0, 2, 1, 1] | |
[0, 2, 1, 0, 2, 1, 0, 2, 1] | |
[2, 1, 0, 2, 0, 0, 2, 2, 0] | |
[1, 1, 2, 1, 0, 2, 0, 0, 2] | |
[2, 1, 0, 2, 0, 0, 2, 1, 1] |
This file contains hidden or 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
import hashlib | |
import sys | |
def xor(s1,s2): | |
return ''.join(chr(ord(a) ^ ord(b)) for a,b in zip(s1,s2)) | |
def repeat(s, l): | |
return (s*(int(l/len(s))+1))[:l] | |
key = sys.argv[1] |
This file contains hidden or 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
function expmod( base, exp, mod ){ | |
if (exp === 0) return 1; | |
if (exp % 2 === 0){ | |
return Math.pow( expmod( base, (exp / 2), mod), 2) % mod; | |
} | |
else { | |
return (base * expmod( base, (exp - 1), mod)) % mod; | |
} | |
} |
This file contains hidden or 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 "stdio.h" | |
int compare(int a, int b){ | |
return a == b; | |
} | |
int main() { | |
int i=0; | |
for(; !compare(i, 5); i++){ |
This file contains hidden or 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 "stdio.h" | |
int main() { | |
for (int i=0;i<5;printf("i = %d\n",i++)){} | |
return 0; | |
} |
This file contains hidden or 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 "stdio.h" | |
int main() { | |
int i=0; | |
for ( ; i != 5 ; ){ | |
printf("i = %d\n", i); | |
i = i+1; | |
} | |
return 0; | |
} |
This file contains hidden or 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 "stdio.h" | |
int main() { | |
int i; | |
//The first part of this for loop is run once as an initialization | |
//the second part is checked for truth at the end of each execution to determine if the loop should be run again | |
//the third part is executed at the end of the loop (typically used to increment something) | |
for (i = 0; i < 5; i++){ | |
printf("i = %d\n", i); | |
} |
This file contains hidden or 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 <iostream> | |
using namespace std; | |
int main() { | |
string text = "text1"; | |
string text2 = "text1"; | |
if (text.compare(text2) == 0){ | |
cout << "They are the same" << endl; | |
} else { |
This file contains hidden or 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 <iostream> | |
using namespace std; | |
int main() { | |
string text = "Andy is the greatest"; | |
cout << text << endl; | |
} |
This file contains hidden or 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 <iostream> | |
//Note that there is a different input/output library iostream | |
//Also a slightly different notation for including <libraryname> instead of "libraryname.h" | |
//Again there is a "main" function with a return type "int" | |
int main() { | |
//Now printf is replaced by a "stream" concept, where "cout" is the output stream | |
//and we pipe values into that output stream by the "<<" operator. | |
//Also the "\n" has a more abstract version "endl" for a platform independent newline character | |
std::cout << "Hello World!" << std::endl; |