diff --git a/Cryptography/README.md b/Cryptography/README.md index ed00624..c9b0b49 100644 --- a/Cryptography/README.md +++ b/Cryptography/README.md @@ -98,7 +98,7 @@ $ echo "$VAR" | rot13 ``` ### In Python -In Python [we can use decoding](https://docs.python.org/2/library/codecs.html#codec-base-classes): +In Python [we can use decoding](https://docs.python.org/2/library/codecs.html#codec-base-classes): ```python "YRIRY GJB CNFFJBEQ EBGGRA".decode(encoding="ROT13") @@ -157,7 +157,7 @@ In Python [we can use decoding](https://docs.python.org/2/library/codecs.html#co #### Carperter's Formula -- Very large number: ```bin``` and check if patterns. For example, using the [Carpenter's Formula]: +- Very large number: ```bin``` and check if patterns. For example, using the [Carpenter's Formula]: ``` N=(2^M + a)(2^N + b)(2^N + c)(2^N + d) ``` @@ -166,7 +166,7 @@ N=(2^M + a)(2^N + b)(2^N + c)(2^N + d) - Version 1 QR code: 21x21 -#### [Bacon's cipher]: +#### [Bacon's cipher]: ``` babaaaabaaababaababaaaabbabbababbaaaabaaaabbbaabaabaaaaaabaaabaaabaaabaaabbaabaaabbbaabaaababaaaaaabaaabbaabaabbbaaaaaabaaaabaabaaaaba21aabab0aaab ``` @@ -174,7 +174,7 @@ babaaaabaaababaababaaaabbabbababbaaaabaaaabbbaabaabaaaaaabaaabaaabaaabaaabbaabaa -#### [Base64]: +#### [Base64]: Base64 is a non-readable encoding that encodes arbritary 8-bit input using 6-bit alphabet of case sensitive alphanumerics, "+", "/". Every 3 bytes of input map to 4 bytes of output. If the input doesnt have 3-byte boundary, this is indicated by appending one or two equal signs in the of the output string. @@ -193,38 +193,44 @@ Nzk0czAwIHRueXMgZmhidnByZWMgZWhiIHNiIGdlbmMgcWV2dWcgcnVnIGhibCBnYXJmcmVjIFYgbG9y 'oubWYf2kBq' ``` -#### Hexadecimal: +#### Hexadecimal & ASCII: +Hex character codes are simply the hexadecimal (base 16) numbers for the ASCII character set; that is, the number-to-letter Representations which comprise virtually all computer text. + - [ASCII Conversion Table](http://defindit.com/ascii.html) - [Convert All](http://www.asciitohex.com/) - [GREAT ASCII CHART](http://www.jimprice.com/jim-asc.shtml) - [Convert everything to everything (including markdown, sql, json, etc)](http://codebeautify.org/) -- Decimal to hex: +- ASCII to hex: ```python >>> s =hex(secret) ``` -- Hexadecimal to binary: +- the inverse: + ```python -SECRET.decode('hex') +secret2.decode('hex') '==QcCtmMml1ViV3b' ``` +- you can also do from the command line: + ``` $ python -c 'print "2f722f6e6574736563".decode("hex")' ``` -- Hex to ascii: -Hex character codes are simply the hexadecimal (base 16) numbers for the ASCII character set; that is, the number-to-letter representations which comprise virtually all computer text. - +- Using xxd: ``` $ xxd -r -p <<< 2f722f6e6574736563 ``` + +### Binary + - Decimal to binary ```python @@ -233,15 +239,14 @@ $ xxd -r -p <<< 2f722f6e6574736563 ``` #### Octal -(or: a great way of obscurating a URL) -Example: http://017700000001 --> 127.0.0.1 +Commonly used in obscuration of URLs. Example: http://017700000001 --> 127.0.0.1 ## OpenSSL, Encoding and Certificates -* Identification and verification of SSL certificates can be done with openssl or +* Identification and verification of SSL certificates can be done with openssl or TLSSLed tools. They allow us to verify this information automatically SSL. To determine the period of validity of licenses: