Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Simple Crypto
ss8651twtw
$ whoami
● 林思辰
● 資工系大三
● BambooFox
● ss8651twtw / linsc04
● ss8651twtw@gmail.com
Outline
● Basis
● Classical cipher
● eXclusive OR
● Hash
● Rivest Shamir Adleman
Basis
String transform
● ASCII
○ BambooFox
● Hex
○ 0x42616d626f6f466f78
● Decimal
○ 1224505484489718656888
● Binary
○ 1000010011...
String transform
● Python
○ 'BambooFox'.encode("hex")
○ '42616d626f6f466f78'.decode("hex")
○ int('0x42616d626f6f466f78', 1...
String transform
● Practice
○ https://bamboofox.cs.nctu.edu.tw/admin/courses/4/challenges/73
○ https://bamboofox.cs.nctu.e...
Base64
Base64
Base64
● Online tool
○ https://www.base64encode.org/
○ https://www.base64decode.org/
● Practice
○ https://bamboofox.cs.nctu.edu.t...
Classical cipher
Caesar cipher
Caesar cipher
● Encrypt
● Decrypt
Caesar cipher
● Online tool
○ https://planetcalc.com/1434/
Substitution cipher
● Plaintext
● Ciphertext
● Random map
● 26! possibility
Substitution cipher
1. Brute force when secret keys are
not too many
2. Use letter frequency analysis when
ciphertext is l...
Substitution cipher
● Online tool
○ https://quipqiup.com/
Rail fence
● Plaintext
● Ciphertext
Rail fence
● Online tool
○ http://rumkin.com/tools/cipher/railfence.php
JSFuck
● Write javascript ONLY with [ ] ( ) ! +
JSFuck
● alert(1)
JSFuck
● Online tool
○ http://www.jsfuck.com/
BrainFuck
BrainFuck
● Online tool
○ https://www.splitbrain.org/services/ook
Something interesting
eXclusive OR
XOR
● Plaintext ^ Pattern = Ciphertext
● Ciphertext ^ Pattern = Plaintext
XOR
xortool
● Secret key is short than message
● The most frequent character
○ file 0x00
○ text 0x20
● https://github.com/hell...
Hash
Hash
Hash collision
● SHA1
● https://shattered.it/
Rivest Shamir Adleman
RSA
1. Generate primes p, q and N = p * q
2. r = (p - 1) * (q - 1)
3. Choose e < r, gcd(e, r) = 1
4. e * d mod r = 1, find...
RSA
● Encrypt
● Decrypt
Factor
● N is small
● Fact N to generate p and q
● https://factordb.com/
Other
Random seed
Reference
● https://en.wikipedia.org/wiki/Base64
● https://en.wikipedia.org/wiki/Caesar_cipher
● https://en.wikipedia.org/...
Q & A
Thanks for listening
Upcoming SlideShare
Loading in …5
×

Simple crypto

554 views

Published on

20017 / 10 / 26
Simple crypto @NCTU
BambooFox

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Simple crypto

  1. 1. Simple Crypto ss8651twtw
  2. 2. $ whoami ● 林思辰 ● 資工系大三 ● BambooFox ● ss8651twtw / linsc04 ● ss8651twtw@gmail.com
  3. 3. Outline ● Basis ● Classical cipher ● eXclusive OR ● Hash ● Rivest Shamir Adleman
  4. 4. Basis
  5. 5. String transform ● ASCII ○ BambooFox ● Hex ○ 0x42616d626f6f466f78 ● Decimal ○ 1224505484489718656888 ● Binary ○ 1000010011000010110110101100010011011110110111101000110011 0111101111000
  6. 6. String transform ● Python ○ 'BambooFox'.encode("hex") ○ '42616d626f6f466f78'.decode("hex") ○ int('0x42616d626f6f466f78', 16) ○ int('10000100110000101101101011000100110111101101111010001100110111101111000', 2) ○ hex(1224505484489718656888) ○ bin(1224505484489718656888)
  7. 7. String transform ● Practice ○ https://bamboofox.cs.nctu.edu.tw/admin/courses/4/challenges/73 ○ https://bamboofox.cs.nctu.edu.tw/admin/courses/4/challenges/74 ○ https://bamboofox.cs.nctu.edu.tw/admin/courses/4/challenges/75
  8. 8. Base64
  9. 9. Base64
  10. 10. Base64
  11. 11. ● Online tool ○ https://www.base64encode.org/ ○ https://www.base64decode.org/ ● Practice ○ https://bamboofox.cs.nctu.edu.tw/admin/courses/4/challenges/76 Base64
  12. 12. Classical cipher
  13. 13. Caesar cipher
  14. 14. Caesar cipher ● Encrypt ● Decrypt
  15. 15. Caesar cipher ● Online tool ○ https://planetcalc.com/1434/
  16. 16. Substitution cipher ● Plaintext ● Ciphertext ● Random map ● 26! possibility
  17. 17. Substitution cipher 1. Brute force when secret keys are not too many 2. Use letter frequency analysis when ciphertext is long
  18. 18. Substitution cipher ● Online tool ○ https://quipqiup.com/
  19. 19. Rail fence ● Plaintext ● Ciphertext
  20. 20. Rail fence ● Online tool ○ http://rumkin.com/tools/cipher/railfence.php
  21. 21. JSFuck ● Write javascript ONLY with [ ] ( ) ! +
  22. 22. JSFuck ● alert(1)
  23. 23. JSFuck ● Online tool ○ http://www.jsfuck.com/
  24. 24. BrainFuck
  25. 25. BrainFuck ● Online tool ○ https://www.splitbrain.org/services/ook
  26. 26. Something interesting
  27. 27. eXclusive OR
  28. 28. XOR ● Plaintext ^ Pattern = Ciphertext ● Ciphertext ^ Pattern = Plaintext
  29. 29. XOR
  30. 30. xortool ● Secret key is short than message ● The most frequent character ○ file 0x00 ○ text 0x20 ● https://github.com/hellman/xortool
  31. 31. Hash
  32. 32. Hash
  33. 33. Hash collision ● SHA1 ● https://shattered.it/
  34. 34. Rivest Shamir Adleman
  35. 35. RSA 1. Generate primes p, q and N = p * q 2. r = (p - 1) * (q - 1) 3. Choose e < r, gcd(e, r) = 1 4. e * d mod r = 1, find d ● Public key = (N, e) ● Private key = (N, d)
  36. 36. RSA ● Encrypt ● Decrypt
  37. 37. Factor ● N is small ● Fact N to generate p and q ● https://factordb.com/
  38. 38. Other
  39. 39. Random seed
  40. 40. Reference ● https://en.wikipedia.org/wiki/Base64 ● https://en.wikipedia.org/wiki/Caesar_cipher ● https://en.wikipedia.org/wiki/Letter_frequency ● https://en.wikipedia.org/wiki/Brainfuck ● https://en.wikipedia.org/wiki/XOR_cipher ● https://en.wikipedia.org/wiki/Hash_function ● https://ctf-wiki.github.io/ctf-wiki/crypto/introduction.html ● https://2017game.picoctf.com
  41. 41. Q & A
  42. 42. Thanks for listening

×