Skip to content

Instantly share code, notes, and snippets.

View overheadhunter's full-sized avatar
🇺🇦

Sebastian Stenzel overheadhunter

🇺🇦
View GitHub Profile
@overheadhunter
overheadhunter / Dockerfile
Last active July 12, 2017 18:16
Discourse 1.8.3 Dockerfile
FROM ruby:2.4
WORKDIR /usr/src/app
ENV RAILS_ENV=production \
RUBY_GC_MALLOC_LIMIT=90000000 \
RUBY_GLOBAL_METHOD_CACHE_SIZE=131072 \
DISCOURSE_DB_HOST=postgres \
DISCOURSE_REDIS_HOST=redis \
DISCOURSE_SERVE_STATIC_ASSETS=true
@overheadhunter
overheadhunter / docker-compose.yml
Last active November 7, 2018 15:59
Cryptomator Server PWD Stack
version: '3.4'
services:
wildfly:
image: skymatic/defendor:0.4.0
environment:
- POSTGRES_USER=defendor
- POSTGRES_PASSWORD=notASecurePassword
- POSTGRES_DB=defendor
- SYSLOG_HOST=syslog
@overheadhunter
overheadhunter / BenchmarkTest.java
Created July 15, 2021 10:58
Benchmark of different strlen() variation
import jdk.incubator.foreign.MemoryAccess;
import jdk.incubator.foreign.MemorySegment;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Fork;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.OutputTimeUnit;
import org.openjdk.jmh.annotations.Warmup;
import org.openjdk.jmh.infra.Blackhole;
@overheadhunter
overheadhunter / concatKdf.ts
Last active July 4, 2022 18:40
TypeScript Key Derivation Functions ANSI-X9.63 and NIST SP 800-56A Rev. 2 ConcatKDF
/**
* KDF as defined in <a href="https://doi.org/10.6028/NIST.SP.800-56Ar2">NIST SP 800-56A Rev. 2 Section 5.8.1</a> using SHA-256
*
* @param z A shared secret
* @param keyDataLen Desired key length (in bytes)
* @param otherInfo Concatenated form of AlgorithmID || PartyUInfo || PartyVInfo {|| SuppPubInfo }{|| SuppPrivInfo }
* @returns key data
*/
public static async concatKDF(z: Uint8Array, keyDataLen: number, otherInfo: Uint8Array): Promise<Uint8Array> {
const hashLen = 32; // output length of SHA-256
@overheadhunter
overheadhunter / DecryptAlloc.java
Last active October 5, 2022 11:48
Example reproducing the issue described in https://bugs.openjdk.org/browse/JDK-8280703
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.nio.ByteBuffer;
import java.security.GeneralSecurityException;
/**
* This demonstrates a memory allocation problem in com.sun.crypto.provider.CipherCore.
* <p>
* To reproduce the issue, run this class using: