Skip to content

Instantly share code, notes, and snippets.

View ph4r05's full-sized avatar
🎯
Focusing

Dušan Klinec ph4r05

🎯
Focusing
View GitHub Profile
@ph4r05
ph4r05 / ct_array_compare.java
Last active November 11, 2021 09:13
Constant time array equality check in java
package ct;
public class CT {
/**
* Constant time array equals check.
* If the lengths do not match the function returns false immediately.
* @param a array A
* @param b array B
* @return true if arrays are equal on defined intervals
--
-- Column DB encryption with indexing using pgcrypto
--
-- Demo encrypt/decrypt identity with pgcrypto
select convert_from(
decrypt_iv(
encrypt_iv(
'test',
digest('superkey', 'sha256'),
@ph4r05
ph4r05 / zim-wiki-mac-osx-app.md
Created May 17, 2017 11:02 — forked from akurani/zim-wiki-mac-osx-app.md
Create a Mac app for Zim Wiki.
@ph4r05
ph4r05 / pyx509_parse.py
Created March 25, 2017 08:04
Parsing X509 certificate, domain extraction
from cryptography.hazmat.backends import default_backend
from cryptography.x509.base import load_pem_x509_certificate
from cryptography.hazmat.primitives.serialization import load_ssh_public_key
from cryptography.hazmat.primitives import hashes
from cryptography.x509.oid import NameOID
from cryptography.x509.oid import ExtensionOID
from cryptography import x509
def get_backend(backend=None):
@ph4r05
ph4r05 / sks-dump-script.sh
Created February 14, 2017 12:34 — forked from mattrude/sks-dump-script.sh
A simple script to export the full database of a sks server to a chosen location.
#!/bin/bash
# This script will stop the sks server, dump it's contents to
# the $PREDIR, then restart the sks server.
#
# Matt Rude <matt@mattrude.com> PGP: 0xDD23BF73
# URL: https://gist.github.com/mattrude/b0ac735d07b0031bb002
SKSDATE=`date +%Y-%m-%d`
USER="debian-sks"
@ph4r05
ph4r05 / tpm-gen.c
Created December 21, 2016 18:32
Generate random numbers with TPM (Trusted Platform Module)
/* gcc -Wall -O2 -ltspi -o tpm-getrand tpm-getrand.c
*
* Usage:
* ./tpm-getrand | dd of=/tmp/random.data count=10 bs=1k
*
* Get random bytes from TPM pRNG
*
* Copyright (C) 2009 Kees Cook <kees@outflux.net>
* http://outflux.net/tpm/tpm-getrand.c
* License: GPLv3