Skip to content

Instantly share code, notes, and snippets.

View AndrewCarterUK's full-sized avatar

Andrew Carter AndrewCarterUK

View GitHub Profile
@AndrewCarterUK
AndrewCarterUK / test.c
Created July 19, 2017 13:21
LoRa Confusion
/*
This program attempts to change the operation mode of a SX1276.
SPI communication is verified as working, as the program is able to select and verify sleep mode.
The SX1276 refuses to enter RXCONTINUOS mode and instead reverts back to STDBY·
Compile:
gcc test.c -lwiringPi -o test
@AndrewCarterUK
AndrewCarterUK / bcrypt-test.cpp
Last active April 26, 2019 10:37
Evaluation of whether the CompareStrings function within node.bcrypt.js is timing safe
#include <stdio.h>
#include <string.h>
#include <ctime>
// Taken from https://github.com/kelektiv/node.bcrypt.js
bool CompareStrings(const char* s1, const char* s2) {
bool eq = true;
int s1_len = strlen(s1);
int s2_len = strlen(s2);
@AndrewCarterUK
AndrewCarterUK / results.dat
Last active April 24, 2019 12:56
CompareStrings function results
s1 s2 t1 t2 t3 t4 t5 Time (s) Error
Z A 4401022 4433686 4393924 4397724 4405599 4.41 0.0071
Z B 4377687 4367294 4370573 4376585 4375585 4.37 0.0020
A Z 4600099 4608625 4620227 4605502 4631544 4.61 0.0056
B Z 4593608 4604220 4577180 4586942 4639593 4.60 0.0108
A A 5980992 5983767 6020037 5977564 5987625 5.99 0.0077
A B 6230444 6116568 6103291 6141156 6176039 6.15 0.0229
B B 5871883 5892847 5886045 5889816 5927863 5.89 0.0093
B A 6156191 6023669 6111652 6269249 6231587 6.16 0.0436