Skip to content

Instantly share code, notes, and snippets.

@getify
getify / gist:7325764
Last active October 26, 2023 04:04
converting between Uint8Arrays and binary-encoded strings and word-arrays (for crypto purposes, with CryptoJS and NaCL)
/*
wordArray: { words: [..], sigBytes: words.length * 4 }
*/
// assumes wordArray is Big-Endian (because it comes from CryptoJS which is all BE)
// From: https://gist.github.com/creationix/07856504cf4d5cede5f9#file-encode-js
function convertWordArrayToUint8Array(wordArray) {
var len = wordArray.words.length,
u8_array = new Uint8Array(len << 2),
offset = 0, word, i
@staltz
staltz / introrx.md
Last active November 19, 2024 18:00
The introduction to Reactive Programming you've been missing
@cicorias
cicorias / Dockerfile
Last active April 5, 2024 08:40
Simple HTTP server in Docker
###
FROM mhart/alpine-node
RUN npm install -g http-server
WORKDIR /site
ADD ./ /site
# The default port of the application