Skip to content

Instantly share code, notes, and snippets.

@latsku
latsku / kernel.log
Created December 13, 2014 19:18
VoCore kernel log
[ 0.000000] Linux version 3.14.18 (vonger@Vongers-MacBook-Pro.local) (gcc version 4.8.3 (OpenWrt/Linaro GCC 4.8-2014.04 r42586) ) #15 Wed Sep 24 11:18:53 CST 2014
[ 0.000000] SoC Type: Ralink RT5350 id:1 rev:3
[ 0.000000] bootconsole [early0] enabled
[ 0.000000] CPU0 revision is: 0001964c (MIPS 24KEc)
[ 0.000000] MIPS: machine is VoCore
[ 0.000000] Determined physical RAM map:
[ 0.000000] memory: 02000000 @ 00000000 (usable)
[ 0.000000] Initrd not found or empty - disabling initrd
[ 0.000000] Zone ranges:
[ 0.000000] Normal [mem 0x00000000-0x01ffffff]
@latsku
latsku / test_packing.c
Last active August 29, 2015 14:20
Test file to demonstrate structure packing on C
/**
* \file
* Test to show how packed structures work in C.
*
* Eric S. Raymond has written a great introduction to structure packing
* (http://www.catb.org/esr/structure-packing/)
*
* @author: Lari Lehtomäki <lari@lehtomaki.fi>
* @date: 2015-05-29
*
@latsku
latsku / TPM2_capabilities.txt
Created August 14, 2015 13:49
Intel NUC TPM2 capabilities
TbsHandle:548
Supported algorithms:
Rsa
Sha1
Hmac
Aes
Keyedhash
Xor
Sha256
Rsassa
@latsku
latsku / tss_hash.py
Created August 14, 2015 13:53
TSS hashing on Python
import os
from ctypes import cdll, create_string_buffer
import binascii
import logging
logger = logging.getLogger()
TSS_HASH_SHA1 = 0x00000001
def main():
@latsku
latsku / tpm1_hash.py
Last active January 22, 2018 20:24
TPM1.2 hashing with just the device node
#!/usr/bin/env python
import binascii
import struct
import logging
logger = logging.getLogger()
#logger.setLevel(logging.DEBUG)
TPM_TAG_RQU_COMMAND = 0x00C1
@latsku
latsku / tpm2_hash.py
Created August 14, 2015 13:59
TPM2.0 hashing with just the device node
import binascii
import struct
import logging
logger = logging.getLogger()
#logger.setLevel(logging.DEBUG)
TPM2_ST_NO_SESSIONS = 0x8001
TPM2_CC_Hash = 0x0000017D
@latsku
latsku / temperature.rb
Created August 14, 2015 14:14
Get weather from Openweathermap
require "rubygems"
require "json"
require "net/http"
require "uri"
location = ARGV.join("%20")
location = "Helsinki,Finland" if location.nil? || location.empty?
uri = URI.parse("http://api.openweathermap.org/data/2.5/weather?q=" + location)
http = Net::HTTP.new(uri.host, uri.port)
@latsku
latsku / Makefile
Created November 6, 2015 19:37
RIOT-OS project Makefile additions for PoEll-i Nucleo ethernet adapter
# Configuration to enable PoEll-i Nucleo ethernet adapter.
USEMODULE += encx24j600
USEMODULE += gnrc_netdev2
CFLAGS += -DENCX24J600_SPI=SPI_0
CFLAGS += -DENCX24J600_CS="GPIO_PIN(PORT_C,10)"
CFLAGS += -DENCX24J600_INT="GPIO_PIN(PORT_D,2)"
@latsku
latsku / Makefile
Created January 20, 2016 14:55
RIOT-OS project Makefile additions for ENC28J60 ethernet adapter
# Configuration to enable ENC28J60 ethernet adapter.
USEMODULE += enc28j60
USEMODULE += gnrc_netdev2
CFLAGS += -DENC28J60_PARAM_SPI=SPI_0
CFLAGS += -DENC28J60_PARAM_CS="GPIO_PIN(PORT_B,6)"
CFLAGS += -DENC28J60_PARAM_INT="GPIO_PIN(PORT_C,7)"
CFLAGS += -DENC28J60_PARAM_RESET="GPIO_PIN(PORT_A,9)"
@latsku
latsku / sha2_constants.m
Created February 15, 2016 18:54
A Mathematica package to calculate SHA-2 constants
(* ::Package:: *)
(* ::Input:: *)
(* SHA-2 Constant calculator
Calculation of SHA-2 uses a group of precomputed constants as part of the hash calculation. These numbers are pregiven on the standard, but also explained to come from fractional part of a cube root of primes. This notebook calculates these constants.
Source: http://dx.doi.org/10.6028/NIST.FIPS.180-4
*)