Skip to content

Instantly share code, notes, and snippets.

Tim Taubert ttaubert

Block or report user

Report or block ttaubert

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View cmul.c
#include <stdint.h>
// 0xff if MSB(x) = 1 else 0x00
uint8_t msb(uint8_t x) {
return 0 - (x >> (8 * sizeof(x) - 1));
// 0xff if a >= b else 0x00
uint8_t nz(uint8_t x) {
return ~msb(~x & (x - 1));
View add.c
#include <stdint.h>
uint8_t add(uint8_t a, uint8_t b) {
uint8_t sum = a + b;
return sum < a ? UINT8_MAX : sum;
ttaubert / onion-gen.js
Created Nov 2, 2014
Generating custom .onion names with the WebCrypto API
View onion-gen.js
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at */
"use strict";
* thirty-two
ttaubert / rc4.js
Last active Aug 29, 2015
RC4 in (almost) a tweet
View rc4.js
function*r(k){t=x=>(y=x%n)in s?s[y]:y;w=_=>t((s[i%n]=t(j+=f=t(i++)))+(s[j%n]=f));for(n=256,s=[i=j=0];i<n;)w(j+=k[i%k.length]);for(j=0,i=1;;)yield w()}
// A raw RC4 stream.
// Works in Firefox only (needs lots of ES6).
// 150 chars
// Usage:
for (var b of r([65,65,65])) {

Keybase proof

I hereby claim:

  • I am ttaubert on github.
  • I am ttaubert ( on keybase.
  • I have a public key whose fingerprint is B1CB F850 F25E 7B7B 8C91 9AA6 4DD9 6198 4B92 E4F2

To claim this, I am signing this object:

You can’t perform that action at this time.