Skip to content

Instantly share code, notes, and snippets.

@swys
swys / verify.txt
Created May 6, 2017 21:14
verify onename account
Verifying that "swysio.id" is my Blockstack ID. https://onename.com/swysio
@swys
swys / cryptoCiphers.js
Created December 9, 2013 03:27
Testing encryption/decryption on all possible Algorithms in nodejs crypto module
var crypto = require('crypto'),
pull = require('pull-stream'),
errors = [],
skipDecrypt = [],
encryptCount = 0,
decryptCount = 0
var vals = 'node issue # 6477 told me to make input to xts algorithm more than 16bytes so that is what i am doing so this should work'
var ciphers = crypto.getCiphers()
@swys
swys / encodeCallbackStyle.js
Created December 5, 2013 04:50
add encode/decode functions to pull-crypto
var crypto = require('crypto'),
pull = require('pull-stream');
exports = module.exports = function(opts, cb) {
if (!opts.password) throw new Error("Must supply password")
var alg = opts.algorithm || 'aes-256-cbc'
var enc = opts.encoding || 'hex'
var ine = opts.inputEncoding || 'utf-8'
var cipher = crypto.createCipher(alg, opts.password)
// canvas stuff
var canvas = document.createElement('canvas');
canvas.id = 'c';
canvas_context = canvas.getContext('2d');
canvas.width = 700;
canvas.height = 300;
canvas.margin = '1em';
canvas.display = 'block';
document.body.appendChild(canvas);
@swys
swys / index.js
Last active December 25, 2015 01:19
requirebin sketch Stream mouse X and Y coordinates to console
var es = require('event-stream'),
EE = require('events').EventEmitter,
through = require('through'),
emitStream = require('emit-stream'),
ee = new EE(),
jsonStream = require('JSONStream');
// Plotter is a simple event emitter that will emit the x and y mouse position values
// these values are then streamed into the console