Skip to content

Instantly share code, notes, and snippets.

View xlanor's full-sized avatar
😬

jingkai. xlanor

😬
  • praying for retirement before layoffs.
  • London, United Kingdom (Ocasionally Singapore)
  • 02:31 (UTC)
View GitHub Profile
@swinton
swinton / AESCipher.py
Last active November 8, 2024 18:31
Encrypt & Decrypt using PyCrypto AES 256 From http://stackoverflow.com/a/12525165/119849
#!/usr/bin/env python
import base64
from Crypto import Random
from Crypto.Cipher import AES
BS = 16
pad = lambda s: s + (BS - len(s) % BS) * chr(BS - len(s) % BS)
unpad = lambda s : s[0:-ord(s[-1])]