Skip to content

Instantly share code, notes, and snippets.

@computator
computator / keybase.md
Last active July 19, 2019 00:33
Keybase Proof

Keybase proof

I hereby claim:

  • I am computator on github.
  • I am rlifshay (https://keybase.io/rlifshay) on keybase.
  • I have a public key whose fingerprint is 5FB1 B3B3 C8E9 5665 CCD6 0088 ADC0 D1AE 5D36 4431

To claim this, I am signing this object:

@computator
computator / const_time_strcmp.php
Created August 8, 2018 03:57
Constant time string comparison function in PHP.
function const_time_strcmp($a, $b) {
// inputs must be strings
if(!is_string($a) || !is_string($b))
return false;
// strings must be the same length
if(strlen($a) !== strlen($b))
return false;
// result will be all zero if values are equal
$c = $a ^ $b;
// add up the byte values. if result is zero then strings are identical
@computator
computator / Vagrantfile
Last active October 25, 2017 09:54
A Vagrantfile illustrating bad ZFS performance with primarycache=metadata
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/xenial64"
# disable serial port to increase boot speed
config.vm.provider "virtualbox" do |v|
v.customize [ "modifyvm", :id, "--uartmode1", "disconnected" ]
end
config.vm.provision "shell", inline: <<-SHELL
apt-get update