Skip to content

Instantly share code, notes, and snippets.

View BobBurns's full-sized avatar

Bob Burns BobBurns

  • Santa Cruz, CA
View GitHub Profile
@BobBurns
BobBurns / lfsr6x5.c
Created January 9, 2016 15:42
Understanding Cryptography 2.11
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define STREAM (256 * 8)
/* short program to understand linear feed shift register
* and its use in stream ciphers.
*
* modified to solve problem 2.11 in Understanding Cryptography by C. Paar
@BobBurns
BobBurns / lfsr.c
Created January 8, 2016 00:40
Linear feed shift register in C with 8 bits
#include <stdio.h>
#include <stdlib.h>
#define STREAM (256 * 8)
/* short program to understand linear feed shift register
* and its use in stream ciphers.
*/
int
@BobBurns
BobBurns / aff_c.c
Created January 3, 2016 01:06
c algorithm to decipher affine cipher
#include <stdio.h>
#include <stdlib.h>
/* quick program to solve affine cipher with key a, b mod 26 */
/* usage: ./aff_c <key a> <key b> <optional e=encrypt>
* cipher-text from stdin or pipe
*/
int
@BobBurns
BobBurns / rijndael_field_sbox.c
Created December 30, 2015 19:35
Rijndail S-box the long way
#include <stdio.h>
/* Rijndael Field S-box transformation
* part of the AES encryption algorythm or Rijndal's block cipher.
*
* code expanded on blog @ www.samiam/galois.html
*/
/* global vars */
@BobBurns
BobBurns / rijndal_field_mul_inv.c
Created December 28, 2015 21:29
program to calculate the multiplicative inverse in Rijndal's Galois Feild.
#include <stdio.h>
/* program to demonstrate how to find multiplicative inverse in Rijndal's Galois Field
* part of the AES encryption algorithm or Rijndal's block cipher.
*
* code expanded on blog @ www.samiam/galois.html
*/
/* global vars */
@ program: systick_tst.s
@ programmer: reb
@ device: stm32L152c discovery eval board
@ description: blink led with systick count down
@ uses systick interrupt routine
@
@ how to compile and flash:
@ arm-none-eabi-as -mcpu=cortex-m3 systick_tst.s -o systick_tst.o
@ arm-none-eabi-ld -v -T stm32.ld -nostartfiles -o systick_tst.elf systick_tst.o
@ arm-none-eabi-objcopy -O binary systick_tst.elf systick_tst.bin
@BobBurns
BobBurns / cylon_eyes.s
Created August 14, 2015 21:05
cylon eyes program in arm assembly for stm32L discovery
@ cylon eyes for stm32L discovery
@ uses lcd software driver 1/4 duty 1/3 bias
@ how to compile and flash:
@ arm-none-eabi-as -mcpu=cortex-m3 cylon_eyes.s -o cylon_eyes.o
@ arm-none-eabi-ld -v -T stm32.ld -nostartfiles -o cylon_eyes.elf cylon_eyes.o
@ arm-none-eabi-objcopy -O binary cylon_eyes.elf cylon_eyes.bin
@ then from st-link (https://github.com/texane/stlink)
@ ./st-flash write ../first_arm/cylon_eyes.bin 0x08000000
.thumb
@BobBurns
BobBurns / stm32.ld
Created July 31, 2015 16:50
linker script to go with blinky.s
/* linker script for STM32 Cortex M3 c/o pygmy.utoh.org */
SECTIONS
{
/* interupt vectors start at zero */
. = 0x0; /* start of flash */
.text : { *(text) }
/* constant data follows code but still in flash */
@BobBurns
BobBurns / blinky.s
Created July 31, 2015 16:45
blink led on stm32 L1 Discovery with ARM assembly
@ lets try to blink an LED on the discovery stm32 L1 board
@ uses LED on PB7
@ how to compile and flash:
@ arm-none-eabi-as -mcpu=cortex-m3 blinky.s -o blinky.o
@ arm-none-eabi-ld -v -T stm32.ld -nostartfiles -o blinky.elf blinky.o
@ arm-none-eabi-objcopy -O binary blinky.elf blinky.bin
@ then from st-link (https://github.com/texane/stlink)
@ ./st-flash write ../first_arm/blinky.bin 0x08000000
.thumb
@BobBurns
BobBurns / nfc_server.ino
Created July 22, 2015 12:10
nfc server for particle web ide
// firmware to receive bytes from atmega186 over USART and send over Wifi
// The atmega168 is programmed to talk to the pn532 nfc card reader and then send the card info
// over USART.
#define debug 0
#define MAXLEN 256
TCPServer server = TCPServer(2342);
TCPClient client;
bool unlocked = false;