Skip to content

Instantly share code, notes, and snippets.

#include <stdio.h>
#include <string.h>
#include <sodium.h>
int checkone (char *hxsecret, char *hxpub, char *hxplaintext, char *hxencrypted) {
int pklen = crypto_box_PUBLICKEYBYTES;
int sklen = crypto_box_SECRETKEYBYTES;
int txtlen = strlen (hxplaintext) / 2;
int encrlen = strlen (hxencrypted) / 2;
@lmctv
lmctv / box_seal_from_api.py
Last active June 2, 2017 22:46
demo implementation of a proposed SealedBox API in terms of high-level pynacl APIs
#!/usr/bin/python
from __future__ import absolute_import, division, print_function
from nacl import exceptions as exc
from nacl.encoding import Encodable, HexEncoder, RawEncoder
from nacl.hash import generichash
from nacl.public import Box, PrivateKey, PublicKey
from nacl.utils import StringFixer
@lmctv
lmctv / privatekey_from_seed.py
Created June 2, 2017 11:29
demo nacl.public.PrivateKey subclass implementing a from_seed alternate contructor
#!/usr/bin/python
#
from __future__ import absolute_import, division, print_function
from nacl import encoding
from nacl import exceptions as exc
from nacl.hash import sha512
from nacl.public import PrivateKey
from nacl.utils import random
@lmctv
lmctv / argondriver.py
Created February 9, 2017 22:37
argon2 runner to generate reference vectors
#!/usr/bin/python
#
from __future__ import division, print_function
import argparse, json, os, random, string, subprocess, sys
class argonRunner(object):
GOODCHARS = string.ascii_letters + string.digits
def __init__(self, args):
self.exe = args.exe