Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Dušan Klinec ph4r05

🎯
Focusing
Block or report user

Report or block ph4r05

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ph4r05
ph4r05 / payment_id_fix.py
Last active Nov 27, 2018
Fixes payment ID problem
View payment_id_fix.py
# pip install monero_agent>=1.7.6
import binascii
import json
import requests
from monero_glue.xmr import crypto
from monero_serialize.xmrserialize import load_uvarint_b, uvarint_size
View determ_randomness.py
class mt19937(object):
# https://github.com/james727/MTP/
def __init__(self, seed = 0):
self.state = [0]*624
self.f = 1812433253
self.m = 397
self.u = 11
self.s = 7
self.b = 0x9D2C5680
self.t = 15
@ph4r05
ph4r05 / demo.java
Last active Nov 13, 2018
Simple java intro test
View demo.java
import javax.crypto.IllegalBlockSizeException;
class Main {
// Normally each class should be in a separate file.
static class Student {
private String name;
public Student(String name){
this.name = name;
View ib111_06_11_2018.py
# task 1: implement logical formula evaluation
# T, F ~ true, false
# !, A, V, > ~ NOT, AND, OR, IMPLICATION
# Hint: translate atoms to integers (store integers on stack)
# Hint: the infix form: (!(F)) A (!((T) > (F)))
def eval_formula(inp):
stack = []
for token in inp:
pass
@ph4r05
ph4r05 / ct_array_compare.java
Last active Dec 9, 2017
Constant time array equality check in java
View ct_array_compare.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
View pgcrypto.sql
--
-- 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 — forked from akurani/zim-wiki-mac-osx-app.md
Create a Mac app for Zim Wiki.
View zim-wiki-mac-osx-app.md
@ph4r05
ph4r05 / pyx509_parse.py
Created Mar 25, 2017
Parsing X509 certificate, domain extraction
View pyx509_parse.py
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 Feb 14, 2017 — forked from mattrude/sks-dump-script.sh
A simple script to export the full database of a sks server to a chosen location.
View sks-dump-script.sh
#!/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 Dec 21, 2016
Generate random numbers with TPM (Trusted Platform Module)
View tpm-gen.c
/* 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
You can’t perform that action at this time.