Skip to content

Instantly share code, notes, and snippets.

View dchest's full-sized avatar
☮️

Dmitry Chestnykh dchest

☮️
View GitHub Profile
@dchest
dchest / gist:e7d1296911f75b0fb4ad0301173a186f
Last active January 2, 2018 21:41
NIST PQC submissions by key/signature/encryption size
Source: https://groups.google.com/a/list.nist.gov/d/msg/pqc-forum/1lDNio0sKq4/fzAd9fewAAAJ
From: D. J. Bernstein
Compared to Ryo Fujita's table, I would list Giophantus as multivariate,
Lepton as code-based (I see LWE->LPN as crossing the lattices->codes
line), and Mersenne/Ramstake/Three Bears in a separate category. I also
think it's a bit silly for NIST to count (e.g.) two pqRSA submissions.
Another way to categorize submissions is by sizes. This is correlated
Analysis of sampling openssl (pid 42557) every 1 millisecond
Process: openssl [42557]
Path: /usr/bin/openssl
Load Address: 0x108287000
Identifier: openssl
Version: 22
Code Type: X86-64
Parent Process: bash [37567]
Date/Time: 2017-10-10 20:17:15.049 +0200
IconSizes | string | gtk-menu=48,48:panel-menu=32,32:panel=16,16:gtk-button=32,32:gtk-large-toolbar=48,48:gtk-small-toolbar=32,32
@dchest
dchest / gimli.js
Last active June 2, 2019 22:41
Gimli permutation in JavaScript. EXPERIMENTAL VERSION
/** Gimli permutation - https://gimli.cr.yp.to */
function gimli(s) {
var r, x, y, z,
a = s[ 0] | s[ 1] << 8 | s[ 2] << 16 | s[ 3] << 24,
b = s[ 4] | s[ 5] << 8 | s[ 6] << 16 | s[ 7] << 24,
c = s[ 8] | s[ 9] << 8 | s[10] << 16 | s[11] << 24,
d = s[12] | s[13] << 8 | s[14] << 16 | s[15] << 24,
e = s[16] | s[17] << 8 | s[18] << 16 | s[19] << 24,
f = s[20] | s[21] << 8 | s[22] << 16 | s[23] << 24,
g = s[24] | s[25] << 8 | s[26] << 16 | s[27] << 24,
@dchest
dchest / buzhash.ts
Created June 20, 2017 17:59
Buzhash with secret key
import { wipe } from "@stablelib/wipe";
/**
* Buzhash implements cyclic polymomial rolling hash function.
* It is a custom developed keyed variant with protections against plain text
* recovery from chunk lengths.
*
* Reading:
*
* http://www.serve.net/buz/Notes.1st.year/HTML/C6/rand.012.html
@dchest
dchest / statement-on-stablelib-root-key-revocation.txt
Created May 14, 2017 21:10
STATEMENT ABOUT STABLELIB ROOT KEY REVOCATION
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
- -----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
- - -----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
- - - -----BEGIN PGP SIGNED MESSAGE-----
@dchest
dchest / sivlike.md
Last active July 27, 2017 13:14
SIV-like deterministic nonce-misuse resistant authenticated encryption construction with BLAKE2s and ChaCha20

SIV-like deterministic nonce-misuse resistant authenticated encryption construction with BLAKE2s and ChaCha20

Variant 1 (without associated data)

Seal (encryption and authentication)

  • key - 32-byte secret key
  • nonce - 8-byte nonce (all-zero by default)
  • plaintext - data to encrypt and authenticate
@dchest
dchest / bad-node.md
Last active April 20, 2017 18:13
Bad things that Node.js does

Bad things that Node.js does

The point of the list is not to complain, but to educate (informing people about unexpected and suprisingly broken things), and propose workarounds.

1. Buffer.from(str, "base64") doesn't validate base64 encoding

Bug report: nodejs/node#8569.

Example

@dchest
dchest / gist:c1985fd5bef3b19bf73f3165fe2e59b6
Created October 13, 2016 07:10
Secure coding guidelines for C
Don't write in C.
@dchest
dchest / simple-promise-retry.js
Created May 23, 2016 21:25 — forked from briancavalier/simple-promise-retry.js
A few general patterns for retries using promises
function keepTrying(otherArgs, promise) {
promise = promise||new Promise();
// try doing the important thing
if(success) {
promise.resolve(result);
} else {
setTimeout(function() {
keepTrying(otherArgs, promise);