Crypto README fixed

This commit is contained in:
Mari Wahl 2014-11-30 07:16:35 -05:00
parent 37cb7d0d10
commit 89c13d1dfd

View file

@ -98,7 +98,7 @@ $ echo "$VAR" | rot13
``` ```
### In Python ### 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 ```python
"YRIRY GJB CNFFJBEQ EBGGRA".decode(encoding="ROT13") "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 #### 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) 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 - Version 1 QR code: 21x21
#### [Bacon's cipher]: #### [Bacon's cipher]:
``` ```
babaaaabaaababaababaaaabbabbababbaaaabaaaabbbaabaabaaaaaabaaabaaabaaabaaabbaabaaabbbaabaaababaaaaaabaaabbaabaabbbaaaaaabaaaabaabaaaaba21aabab0aaab 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. 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' '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) - [ASCII Conversion Table](http://defindit.com/ascii.html)
- [Convert All](http://www.asciitohex.com/) - [Convert All](http://www.asciitohex.com/)
- [GREAT ASCII CHART](http://www.jimprice.com/jim-asc.shtml) - [GREAT ASCII CHART](http://www.jimprice.com/jim-asc.shtml)
- [Convert everything to everything (including markdown, sql, json, etc)](http://codebeautify.org/) - [Convert everything to everything (including markdown, sql, json, etc)](http://codebeautify.org/)
- Decimal to hex: - ASCII to hex:
```python ```python
>>> s =hex(secret) >>> s =hex(secret)
``` ```
- Hexadecimal to binary: - the inverse:
```python ```python
SECRET.decode('hex') secret2.decode('hex')
'==QcCtmMml1ViV3b' '==QcCtmMml1ViV3b'
``` ```
- you can also do from the command line:
``` ```
$ python -c 'print "2f722f6e6574736563".decode("hex")' $ python -c 'print "2f722f6e6574736563".decode("hex")'
``` ```
- Hex to ascii: - Using xxd:
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.
``` ```
$ xxd -r -p <<< 2f722f6e6574736563 $ xxd -r -p <<< 2f722f6e6574736563
``` ```
### Binary
- Decimal to binary - Decimal to binary
```python ```python
@ -233,15 +239,14 @@ $ xxd -r -p <<< 2f722f6e6574736563
``` ```
#### Octal #### 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 ## 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. TLSSLed tools. They allow us to verify this information automatically SSL.
To determine the period of validity of licenses: To determine the period of validity of licenses: