Skip to content

Instantly share code, notes, and snippets.

View AndrewCarterUK's full-sized avatar

Andrew Carter AndrewCarterUK

View GitHub Profile
@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
@AndrewCarterUK
AndrewCarterUK / phpixie-sockpuppets.md
Last active October 28, 2017 20:29
PHPixie using sockpuppets on /r/php

See this thread here

/u/dracony Based on the previous comments I updated the base auth project to include separate user and admin logins (totaly separate auth domains), added a .gif demo for the lazy ( http://i.imgur.com/WznceCf.gif ) and the ability to impersonate users.

/u/phpgeek Wow, that's actually something I could use.

/u/underdogging10 >>> Just gonna throw this out there... but you seem to always post positively on any PHPixie post shortly after it is posted. Pretty sure this is just /u/dracony. In fact, basically everything you have posted over the last 3 months is just praise of PHPixie.

@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 / gchq-puzzle.c
Last active July 3, 2017 22:21
Programming solution to the GCHQ puzzle on BBC Radio 4, Mon 3rd July 2017
/**
* Programming solution to the GCHQ puzzle on BBC Radio 4, Mon 3rd July 2017
* http://www.bbc.co.uk/programmes/articles/5wkxjTtqRvq8Cyrrjxtk7tc/puzzle-for-today
*
* Output:
* 4 -> 123+45-67+8-9
* 4 -> 123+4-5+67-89
* 3 -> 123-45-67+89
* 6 -> 123-4-5-6-7+8-9
* 6 -> 12+3+4+5-6-7+89
@AndrewCarterUK
AndrewCarterUK / phpixie-stats.php
Created May 9, 2016 14:07
Script used to verify fraudulent installs on PHPixie.
<?php
function getJsonPage($url)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
@AndrewCarterUK
AndrewCarterUK / GPS.php
Last active August 10, 2016 11:00
GPS NMEA Parser in PHP. Tested on a Raspberry Pi with a GY-GPS6MU2.
<?php
class GPS
{
private $serialFile;
public function __construct($serialFile)
{
$this->serialFile = $serialFile;
}

Keybase proof

I hereby claim:

  • I am AndrewCarterUK on github.
  • I am andrewcarteruk (https://keybase.io/andrewcarteruk) on keybase.
  • I have a public key whose fingerprint is 816F E758 8C26 645F DEC6 AEC3 7A29 1B28 6F00 60B0

To claim this, I am signing this object:

@AndrewCarterUK
AndrewCarterUK / sitepoint-survey-parser.php
Last active May 12, 2016 10:53
Verifying PHPixie fraud on SitePoint survey
<?php
// https://raw.githubusercontent.com/sitepoint-editors/php-fw-survey-2015/master/dump/survey.csv
$stream = fopen('survey.csv', 'r');
$headers = fgetcsv($stream);
$count = 0;
$phpixieCount = 0;
$nonPhpixieErrorCount = 0;
@AndrewCarterUK
AndrewCarterUK / class-preloading.php
Last active February 12, 2016 16:01
Class "preloading" with Composer
<?php
/*
This should work because composer registers a callback using
'spl_autoload_register' for when a class is used that has not
already been loaded. Loading the class before hand will
prevent that callback being triggered by PHP.
*/