Skip to content

Instantly share code, notes, and snippets.

View nmoinvaz's full-sized avatar

Nathan Moinvaziri nmoinvaz

  • Phoenix, United States
View GitHub Profile
@nmoinvaz
nmoinvaz / adler32_benchmark.cc
Last active May 25, 2020 13:44
Google benchmark for testing adler32 variants.
/* adler32_benchmark.cc -- test adler32 variants
* Copyright (C) 2020 Nathan Moinvaziri
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/*
cmake . -A Win32 -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL -DWITH_GZFILEOP=ON -DBUILD_SHARED_LIBS=OFF
cmake_minimum_required(VERSION 3.17)
cmake_policy(SET CMP0091 NEW)
@nmoinvaz
nmoinvaz / inflateparams.c
Last active May 25, 2020 13:43
Zlib-ng inflate testing command line
/* inflateparams.c -- test inflate using different parameters
* Copyright (C) 2020 Nathan Moinvaziri
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/*
add_executable(inflateparams test/inflateparams.c)
configure_test_executable(inflateparams)
*/
@nmoinvaz
nmoinvaz / hash_benchmark.cc
Last active May 25, 2020 13:43
Google benchmark for zlib-ng hashing functions
/* hash_benchmark.cc -- test hash function variants
* Copyright (C) 2020 Nathan Moinvaziri
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/*
cmake . -A Win32 -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL -DBUILD_SHARED_LIBS=OFF
cmake_minimum_required(VERSION 3.17)
@nmoinvaz
nmoinvaz / hash_test.py
Last active May 9, 2020 07:58
Testing hash functions in python for zlib-ng
import matplotlib.pyplot as plt
import numpy as np
import random
import timeit
import time
import math
import argparse
import zlib
from random import seed
import struct
@nmoinvaz
nmoinvaz / powershell-cert.md
Last active January 22, 2023 18:11
Powershell Commands for Certificates

Self-signed Code Signing Certificate

To create the code signing certificate using PowerShell (using Administrator prompt):

$cert = New-SelfSignedCertificate -Subject "My Certificate" -Type CodeSigning -CertStoreLocation Cert:\CurrentUser\My -NotAfter (Get-Date).AddYears(100)

To export the certificate from the certificate store:

$certPassword = ConvertTo-SecureString -String "passwordhere" -Force –AsPlainText
$cert | Export-PfxCertificate -FilePath "mycert.pfx" -Password $certPassword
@nmoinvaz
nmoinvaz / compare258_results.md
Last active March 29, 2020 18:55
compare_258_results.md

pigznmoinvaz.exe is built off nmoinvaz/zlib-ng branch improvements/compare-258.

(base) PS E:\pigz-bench-python> python .\b_speed_threads.py
Skipping test: Unable to find "gzip"
exe     level   ms      mb/s    %       threads
pigzCloudflare.exe      3       212     270     47.30   0
pigzCloudflare.exe      6       281     203     46.68   0
pigzCloudflare.exe      9       408     140     46.60   0
pigzCloudflare.exe      3       778     74      47.31   1

pigzCustom.exe is built off nmoinvaz/zlib-ng branch improvements/update-hash-v3.

(base) C:\Users\nathan\Source\pigz-bench-python>python ./b_speed_threads.py
Skipping test: Unable to find "gzip"
exe     level   ms      mb/s    %       threads
pigzCloudflare.exe      3       416     138     47.30   0
pigzCloudflare.exe      6       552     104     46.68   0
pigzCloudflare.exe      9       771     74      46.60   0
pigzCloudflare.exe      3       1842    31      47.31   1
@nmoinvaz
nmoinvaz / compare258_test.c
Last active May 25, 2020 13:46
Zlib-ng test for compare258 returning proper match length
/* compare258_test.c -- test compare258 result lengths
* Copyright (C) 2020 Nathan Moinvaziri
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/*
cmake . -DBUILD_SHARED_LIBS=OFF
add_executable(compare258_test compare258_test.c)
configure_test_executable(compare258_test)
@nmoinvaz
nmoinvaz / compare258.txt
Created February 22, 2020 04:31
zlib compare258 results
len: 0
compare258 average ms: 1
compare258_unaligned_16 average ms: 1
compare258_unaligned_32 average ms: 1
compare258_unaligned_64 average ms: 1
compare258_unaligned_128 average ms: 1
len: 1
compare258 average ms: 1
compare258_unaligned_16 average ms: 1
compare258_unaligned_32 average ms: 1
@nmoinvaz
nmoinvaz / compare258.c
Last active May 25, 2020 14:22
Zlib-ng compare258
/* compare258.c -- compare258 variants for use in longest_match
* Copyright (C) 2020 Nathan Moinvaziri
* For conditions of distribution and use, see copyright notice in zlib.h
*/
// ALIGNED, byte comparison
static inline int32_t compare258(const unsigned char *src0, const unsigned char *src1) {
register const unsigned char *src0start = src0;
register const unsigned char *src0end = src0 + 258; // 258 % 6 = 0