Skip to content

Instantly share code, notes, and snippets.

@pgergis
pgergis / keybase.md
Created September 9, 2019 17:15
Keybase Proof

Keybase proof

I hereby claim:

  • I am pgergis on github.
  • I am pgergis (https://keybase.io/pgergis) on keybase.
  • I have a public key ASBKowxsFEj6wIF8ls7zrqOEq1w5ZQdn5_9sxwmnL8_H5go

To claim this, I am signing this object:

@pgergis
pgergis / bencode.py
Last active August 7, 2018 17:52
bencode
import io
def _str_decode(fd, str_len):
len_digits = [str(str_len)]
char = fd.read(1)
while char != ':':
len_digits.append(char)
char = fd.read(1)
try:
str_len = int(''.join(len_digits))
@pgergis
pgergis / cryptoMath.hs
Created July 17, 2018 17:50
Basic Crypto Math (Haskell)
--file: cryptoMath.hs
-- Cryptopals: http://cryptopals.com/sets/1
-- Hex encoding: [0..9][A..F]
-- B64 encoding: [A..Z][a..z][0..9][+][/][[=]]
-- Note: Each hex char is 4 bits; each b64 char is 6 bits
module CryptoMath where
@pgergis
pgergis / vigenereCipher.hs
Last active July 10, 2018 22:46
Vigenere Cipher Encoding (Haskell)
-- file: vigenereCipher.hs
import Data.Char
let2int :: Char -> Int
let2int c = ord c - ord 'a'
int2let :: Int -> Char
int2let n = chr (ord 'a' + n)