Skip to content

Instantly share code, notes, and snippets.

@svpv
svpv / bench.c
Last active August 22, 2020 09:48
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <x86intrin.h>
#include "setstring.h"
#include "ss12.h"
#include "qsort.h"
#define Mask(k) ((1U << (k)) - 1)
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <assert.h>
static void printfpp(const char *buf, size_t n)
{
bool newline = (buf[n-1] == '\n');
n -= newline;
#define FUNC(name) \
.global name; \
.hidden name; \
.type name,@function; \
.align 16; \
name:
#define ENDF(name) \
.size name,.-name
#include <stdio.h>
#include <stdint.h>
#include <assert.h>
#include "base64.h"
#if defined(__i386__) || defined(__x86_64__)
#include <x86intrin.h>
#define rdtsc() __rdtsc()
#else
static inline uint64_t rdtsc(void)
@svpv
svpv / ZrHa-avalanche.c
Last active October 5, 2019 04:40
ZrHa_update avalanche diagram
// Copyright (c) 2019 Alexey Tourbin
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
@svpv
svpv / meowfile.c
Last active July 21, 2019 05:55
Meow hash of a file
#include <stdio.h>
#include <assert.h>
#include <inttypes.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <x86intrin.h>
#include "meow_hash_x64_aesni.h"
@svpv
svpv / stats.pl
Last active July 11, 2019 04:31
stats.pl - descriptive statistics on the command line
#!/usr/bin/perl
use strict;
my @data;
while (<>) {
# Empty line?
my ($w) = split or next;
# First column numeric.
use Scalar::Util qw(looks_like_number);
@svpv
svpv / wmul-collisions.c
Last active May 21, 2019 01:42
Collisions produced by primitives based on wide multiplication (32*32->64)
// Copyright (c) 2019 Alexey Tourbin
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in