Skip to content

Instantly share code, notes, and snippets.

View engineerball's full-sized avatar
🏠
Working from home

engineerball engineerball

🏠
Working from home
View GitHub Profile
#cloud-config
users:
- name: core
ssh-authorized-keys:
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCbl2K9rz8aHoDks1+rjqN9aefeHe7ePiLJsTSgP4empJInzf6/nXd1FD5vC7TJAJ6UwkhqxEQiSe/ziglZQTKyqM5RTrjsfAWCBRdTOLcEDel59gEKIMJ9eV6PfLmGApxiER1Hqv8WUHv+6QdEICyaszo+nXYHQHwFap5jSl6JUKFhGv8StDpH8/7LsVQFJKZTFvKoCREyUZ3G56Tq2Cre+kUnoytpX9FlOI/9KvBkC8kUwrRY5Bd4vZY6SJ210Bhi7J0tM3wchB0W08R+cCmYWJrxQpEeYtXVWCeQXENyiDmTBOa1C/mE2jvOXOUpz6v7jL+vhJMSPtKpFu3wvOfd ball@ultraball
groups:
- sudo
shell: /bin/bash
@engineerball
engineerball / comparehex.py
Last active October 22, 2015 08:16
CompareHex in python
def comparehex(algorithm, hexstring1, hexstring2):
if algorithm == "md5":
num_of_bits = 128
elif algorithm == "sha1":
num_of_bits = 168
elif algorithm == "sha256":
num_of_bits = 256
print "Algorithm: ", algorithm
binstring1 = bin(int(hexstring1, 16))[2:].zfill(num_of_bits)
@engineerball
engineerball / modular-multiplicative-inverse.py
Last active March 5, 2026 15:11
A python code for calculate GCD and modular multiplicative inverse
def inverseMod(a, m):
for i in range(1,m):
if ( m*i + 1) % a == 0:
return ( m*i + 1) // a
return None
def gcd(a, b):
"""Calculate the Greatest Common Divisor of a and b.
Unless b==0, the result will have the same sign as b (so that when
b is divided by it, the result comes out positive).
@engineerball
engineerball / decryption.sh
Last active September 8, 2015 04:37
generate file 100B, 10KB, 1MB, 100MB using openssl and test encrypt and decrypt
#!/bin/sh
PASSWORD="COYS"
DATE=`date +'%Y%m%d-%H%M%S'`
OUTPUT="decryption-result-$DATE.txt"
mkdir "plaintext"
touch $OUTPUT
for i in 100 10240 1000000 100000000