Skip to content

Instantly share code, notes, and snippets.

@jduncanator
jduncanator / Program.cs
Last active August 28, 2022 12:07
Execute a InterlockedCompareExchange128 natively from C#
using System;
using System.Runtime.InteropServices;
namespace NativeExec
{
class Program
{
delegate byte InterlockedCompareExchange128(IntPtr dest, long exchangeHigh, long exchangeLow, IntPtr comparand);
static unsafe void Main(string[] args)
@jduncanator
jduncanator / index.html
Created February 10, 2016 08:51
WhatTheKeyCode
<!DOCTYPE html>
<html>
<head>
<title>What The Key Code?</title>
<meta name="description" content="JavaScript keyCode finder" />
<meta name="keywords" content="JavaScript,keyCode,key,code" />
<style type="text/css">
body {
font-weight: 100;
@jduncanator
jduncanator / generate.js
Created December 22, 2013 08:18
Simple node.js script to generate test vectors for crypto-browserify. For HMAC, the current test vectors take `boo` as the key (as seen below), for Hashes, just change `createHmac` to `createHash` and loose the 2nd parameter and run it again!
var crypto = require('crypto')
, fs = require('fs');
var algos = [ 'md4', 'md5', 'sha1', 'sha224', 'sha256' ];
var vectors = {};
algos.forEach(function(algo) {
vectors[algo] = {
'Test123': {
'hex': crypto.createHmac(algo, 'boo').update('Test123').digest('hex'),
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
</body>
</html>