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
/* crypto_hash - sha256 */ | |
// Written in 2014 by Devi Mandiri. Public domain. | |
// | |
// Implementation derived from TweetNaCl version 20140427. | |
// See for details: http://tweetnacl.cr.yp.to/ | |
// | |
function load(x, pos) { | |
return x[pos+3] | (x[pos+2]<<8) | (x[pos+1]<<16) | (x[pos]<<24); | |
} |
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
/** | |
* kummer scalar multiplication - ref5 | |
* | |
* ported from SUPERCOP 20140529 | |
* | |
* see for details: http://bench.cr.yp.to/supercop.html | |
*/ | |
var KummerScalarmult = (function() { | |
/* bitwise dance helper*/ |
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
!function(n){"use strict";function e(n,e){var r=255&n[e];return r|=(255&n[e+1])<<8,r|=(255&n[e+2])<<16,r|=(255&n[e+3])<<24}function r(n,e,r){n[e]=255&r,r>>>=8,n[e+1]=255&r,r>>>=8,n[e+2]=255&r,r>>>=8,n[e+3]=255&r}function f(){for(var n=0,e=0;e<arguments.length;e++)n=n+arguments[e]>>>0;return n}function t(n,e){return(n>>>e|n<<32-e)>>>0}function o(n,e,r,o,u,i){g[r]=f(g[r],g[o],p[d[n][2*e]]),g[i]=t(g[i]^g[r],16),g[u]=f(g[u],g[i]),g[o]=t(g[o]^g[u],12),g[r]=f(g[r],g[o],p[d[n][2*e+1]]),g[i]=t(g[i]^g[r],8),g[u]=f(g[u],g[i]),g[o]=t(g[o]^g[u],7)}function u(n,r){n.t[0]+=r,n.t[1]+=n.t[0]<r?1:0;var f=0;for(f=16;f--;)p[f]=e(n.buf,4*f);for(f=8;f--;)g[f]=n.h[f];for(g[8]=b[0],g[9]=b[1],g[10]=b[2],g[11]=b[3],g[12]=(b[4]^n.t[0])>>>0,g[13]=(b[5]^n.t[1])>>>0,g[14]=(b[6]^n.f[0])>>>0,g[15]=(b[7]^n.f[1])>>>0,f=0;10>f;f++)o(f,0,0,4,8,12),o(f,1,1,5,9,13),o(f,2,2,6,10,14),o(f,3,3,7,11,15),o(f,4,0,5,10,15),o(f,5,1,6,11,12),o(f,6,2,7,8,13),o(f,7,3,4,9,14);for(f=8;f--;)n.h[f]^=g[f]^g[f+8]}function i(n,e,r){r=0|r;for(var f=0,t=0;r>0;){var |
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
(function(exports) { | |
'use strict'; | |
// BLAKE2s implementation for javascript | |
// Written in 2014 by Devi Mandiri. Public domain. | |
/* jshint newcap: false */ | |
/* jshint bitwise: false */ | |
var iv = [ |
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
<?php | |
/** | |
* PHP port of https://github.com/agl/curve25519-donna | |
* | |
* curve25519-donna is copyrighted by Google Inc. | |
* | |
* | |
* Usage: | |
* - Generate secret key: | |
* dd if=/dev/urandom bs=32 count=1 of="/path/to/keyfile" |
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
<?php | |
class SimpleArray implements Iterator, ArrayAccess, Countable { | |
private $size = 1; | |
private $buffer = null; | |
private $index = 0; |
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
<?php | |
class Curve25519 { | |
const CRYPTO_SCALARBYTES = 32; | |
protected $minusp = null; | |
public function __construct() { | |
$this->minusp = new SplFixedArray(32); |
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
<?php | |
/** | |
* Port of cryptocat elliptic.js | |
* | |
* https://github.com/cryptocat/cryptocat/blob/master/src/core/js/lib/elliptic.js | |
* commit: b4c87fb6ff20afb069d7ba951afaf9db5fd9c242 | |
*/ | |
class curve25519 { | |
// p25519 is the curve25519 prime: 2^255 - 19 |
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
// Generate RSA key pair in PEM format. | |
package main | |
import ( | |
"crypto/rand" | |
"crypto/rsa" | |
"crypto/x509" | |
"encoding/pem" | |
"flag" | |
"fmt" |
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
// httplistener is a simplified version of camlistore.org/pkg/webserver | |
package httplistener | |
import ( | |
"crypto/rand" | |
"crypto/tls" | |
"fmt" | |
"github.com/bradfitz/runsit/listen" | |
"net" | |
"time" |