This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Python implementation of PKCS #7 padding. | |
RFC 2315: PKCS#7 page 21 | |
Some content-encryption algorithms assume the | |
input length is a multiple of k octets, where k > 1, and | |
let the application define a method for handling inputs | |
whose lengths are not a multiple of k octets. For such | |
algorithms, the method shall be to pad the input at the | |
trailing end with k - (l mod k) octets all having value k - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
""" | |
from Crypto import Random | |
from Crypto.Cipher import AES | |
import pkcs7 | |
random = Random.new().read |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
whmac.py3 | |
Convenient HMAC wrappers. | |
Author: github.com/adoc | |
Location: https://gist.github.com/adoc/8552289 | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Several Messaging classes, building blocks and helpers. | |
Author: github.com/adoc | |
""" | |
import os | |
import base64 | |
import json as _json | |
import functools |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Convenient JS Package wrapping that also will hook require.js if present. | |
*/ | |
(function(window) { | |
// Your package goes here. | |
var MyPackage = {}; | |
// Set global object. | |
window.MyPackage = MyPackage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
hmac.js | |
Using CryptoJS, implements HMAC algorithm while also hashing and appending | |
timestamp information. | |
Author: github.com/adoc | |
Location: https://gist.github.com/adoc/8611494 | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//http://www-cs-students.stanford.edu/~tjw/jsbn/prng.js | |
// prng4.js - uses Arcfour as a PRNG | |
function Arcfour() { | |
this.i = 0; | |
this.j = 0; | |
this.S = new Array(); | |
} | |
// Initialize arcfour context from key, an array of ints, each from [0..255] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Just some functions to help out with byteArrays. | |
Authors and Inspiration: github.com/adoc and Various Others. | |
*/ | |
// Converts an integer to bytes. | |
var intToBytes = function(n) { | |
var result = ''; | |
while (n) { |
OlderNewer