Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am jbdatko on github.
  • I am jbdatko (https://keybase.io/jbdatko) on keybase.
  • I have a public key ASBbd9d5mnvZpHaudSZAhk38DQ3nT9bn6L9RJLPoGpjzQgo

To claim this, I am signing this object:

### Keybase proof
I hereby claim:
* I am jbdatko on github.
* I am jbdatko (https://keybase.io/jbdatko) on keybase.
* I have a public key whose fingerprint is 6F33 342B C6CF D0C8 4DA0 C7CA F7C6 0BFB B3B9 9FA3
To claim this, I am signing this object:
@jbdatko
jbdatko / totp.c
Last active March 22, 2017 19:40 — forked from syzdek/totp.c
/*
* TOTP: Time-Based One-Time Password Algorithm
* Copyright (c) 2015, David M. Syzdek <[email protected]>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* 1. Redistributions of source code must retain the above copyright
@jbdatko
jbdatko / cryptoshield_rfid.ino
Created April 6, 2015 20:19
RFID example for CryptoShield
const int TAG_LENGTH = 13;
char tag[TAG_LENGTH + 2];
int index = 0;
void setup(){
Serial.begin(9600);
memset(tag, 0, sizeof(tag));
}
void loop(){
@jbdatko
jbdatko / cylon.ino
Created October 21, 2014 23:34
Cylon SAINTCON Blinky
#include <tlc_shifts.h>
#include <tlc_config.h>
#include <tlc_animations.h>
#include <tlc_fades.h>
#include <tlc_servos.h>
#include <Tlc5940.h>
#include <tlc_progmem_utils.h>
/*
Blinky code for SAINTcon 2014
@jbdatko
jbdatko / bbfsa.tex
Created September 21, 2014 16:59
BeagleBone for Secret Agents BibTeX entry
@Book{datko2014,
author = "Josh Datko",
title = "BeagleBone for Secret Agents",
publisher = "Packt Publishing",
year = 2014,
address = "Birmingham, UK",
month = "September",
url = "https://www.packtpub.com/hardware-and-creative/beaglebone-secret-agents"
}
@jbdatko
jbdatko / changehostname.sh
Created August 29, 2014 18:03
Script to change hostnames on debian systems
#!/bin/bash
if [[ "$#" -ne 1 ]]; then
echo "$0 usage: newhostname (run as root)"
exit 1
fi
name=$(hostname)
hostname $1
@jbdatko
jbdatko / tpm_assertpp.c
Last active August 29, 2015 14:05
Asserts physical presence on the Atmel I2C TPM. Stop tcsd, send the command, and restart tcsd. Thanks to @theopolis for initial version of this code!
/* -*- mode: c; c-file-style: "gnu" -*-
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@jbdatko
jbdatko / keybase.md
Created April 6, 2014 04:33
keybase.md

Keybase proof

I hereby claim:

  • I am jbdatko on github.
  • I am jbdatko (https://keybase.io/jbdatko) on keybase.
  • I have a public key whose fingerprint is B591 9B1A C713 5905 F466 9C84 7BFA 5031 BD2E DEA6

To claim this, I am signing this object:

@jbdatko
jbdatko / gcm.py
Created November 12, 2013 04:23
Example of pycrypto CCM mode
from Crypto.Cipher import AES
from Crypto.Random import get_random_bytes
hdr = b'To your eyes only'
plaintext = b'Attack at dawn'
key = b'Sixteen byte key'
nonce = get_random_bytes(11)
cipher = AES.new(key, AES.MODE_CCM, nonce)
cipher.update(hdr)
msg = nonce, hdr, cipher.encrypt(plaintext), cipher.digest()