From 6f30dedf9045615d021c80630d5e44224417e5e4 Mon Sep 17 00:00:00 2001 From: agusmakmun <summon.agus@gmail.com> Date: Sat, 21 May 2016 14:38:03 +0700 Subject: [PATCH] Add post Python Simple Ciphertext --- _posts/2016-05-21-python-simple-ciphertext.md | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 _posts/2016-05-21-python-simple-ciphertext.md diff --git a/_posts/2016-05-21-python-simple-ciphertext.md b/_posts/2016-05-21-python-simple-ciphertext.md new file mode 100644 index 0000000..fe5a47c --- /dev/null +++ b/_posts/2016-05-21-python-simple-ciphertext.md @@ -0,0 +1,21 @@ +--- +layout: post +title: "Python Simple Ciphertext" +date: 2016-05-21 14:32:04 +0700 +categories: [python, security] +--- + +Simply how to make a ciphertext only with 1 line. in this sample, the plaintext is result encoded from hexa. + +```python +>>> #hex_encode = 'summonagus'.encode('hex') +>>> hex_encode = '73756d6d6f6e61677573' +>>> chip = ''.join([ str(int(a)*2) if a.isdigit() and int(a) == 3 else str(int(a)/2) if a.isdigit() and int(a) == 6 else a for a in hex_encode ]) +>>> +>>> hex_encode +'73756d6d6f6e61677573' +>>> chip +'76753d3d3f3e31377576' +>>> +>>> +``` \ No newline at end of file -- GitLab