Skip to content

Instantly share code, notes, and snippets.

View ar1ja's full-sized avatar
🏳️‍⚧️

Arija A. (Ari Archer) (migrated to https://git.ari.lt/ari) ar1ja

🏳️‍⚧️
View GitHub Profile
@ar1ja
ar1ja / compile.sh
Created December 7, 2025 15:43
Safe and Sophie Germain prime number generator
#!/bin/sh
set -eux
main() {
rm -f default.profraw genprime.profdata
clang -o genprime -fprofile-instr-generate -Wpedantic -flto=full -fno-trapping-math -fno-math-errno -fno-stack-check -fno-strict-overflow -funroll-loops -fno-stack-protector -fvisibility-inlines-hidden -mfancy-math-387 -fomit-frame-pointer -fstrict-overflow -Wshadow -fno-exceptions -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 -Wall -Wextra -fno-signed-zeros -fno-strict-aliasing -pedantic -O3 -fvisibility=hidden -ffast-math -funsafe-math-optimizations -std=c99 -fno-asynchronous-unwind-tables -Werror -fdiscard-value-names -femit-all-decls -fmerge-all-constants -fno-use-cxa-atexit -fno-use-init-array -march=native -mtune=native -pedantic-errors genprime.c -lgmp -lpthread -s -Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack -Wl,--as-needed -Wl,--no-copy-dt-needed-entries
llvm-strip --strip-debug --strip-sections --strip-unneeded -T --remove-section=.note.gnu.gold-version --remove-section=.note --strip-all --discard-locals --remove-section=.gnu.
@ar1ja
ar1ja / ssh.js
Created November 16, 2025 08:26
SSH public key parser and signature validator in pure JavaScript using browser crypto API
/**
* @licstart The following is the entire license notice for the JavaScript
* code in this file.
*
* Copyright (C) 2025 Arija A. <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
@ar1ja
ar1ja / blake2s.c
Last active October 27, 2024 20:59
BLAKE2s hashing algorithm from scratch in the C programming language.
/*
* This file is/was a part of the Vessel project. (https://git.ari.lt/ari/vessel)
*
* Copyright (C) 2024 Ari Archer <[email protected]>
*
* Vessel is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
@ar1ja
ar1ja / siphash.c
Created September 25, 2024 19:44
Simple SipHash16, SipHash32, and SipHash64 implementation in C (public domain)
/*
* UNLICENSE
*
* This is free and unencumbered software released into the public domain.
*
* Anyone is free to copy, modify, publish, use, compile, sell, or
* distribute this software, either in source code form or as a compiled
* binary, for any purpose, commercial or non-commercial, and by any
* means.
*
@ar1ja
ar1ja / pgpkeydns.sh
Last active August 21, 2024 08:45
OPENPGPKEY DNS record generator implementing RFC 7929 (https://www.rfc-editor.org/rfc/rfc7929.txt)
#!/usr/bin/env sh
# OPENPGPKEY DNS record generator implementing RFC 7929 (https://www.rfc-editor.org/rfc/rfc7929.txt)
#
# NOT IMPLEMENTED:
#
# 2. The local-part is first canonicalized using the following rules.
# If the local-part is unquoted, any comments and/or folding
# whitespace (CFWS) around dots (".") is removed. Any enclosing
# double quotes are removed. Any literal quoting is removed.
@ar1ja
ar1ja / fw.sh
Last active February 20, 2025 23:46
Use IPTables and IP6Tables as a firewall in Linux easily for SSH, HTTP(S), Email, Matrix, and XMPP traffic.
echo 'See https://git.ari.lt/ari.lt/fw.sh'
exit 1
@ar1ja
ar1ja / matrix.c
Last active October 19, 2024 12:02
Matrix arithmetic in C
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include "include/mem.h"
#include "include/matrix.h"
#ifndef INFINITY
#define INFINITY HUGE_VAL
@ar1ja
ar1ja / ML.java
Created May 22, 2024 03:48
A machine learning model example in Java: prediction of f(x) = x/pi
/*
* Me and #root:ari.lt people on Matrix are messing aroung with
* Java and I went from Hello World to Fibonacci, to Machine Learning.
* Enjoy
*
* License: Unlicense
*/
import java.util.Random;
@ar1ja
ar1ja / client.py
Created May 17, 2024 16:05
Example of encrypted an socket connection in Python 3 (For TruncatedDinoSour/armour Standard Network Application Programming Interface (SNAPI) version 0): ECDH (Elliptic Curve Diffie-Hellman) with the SECP521R1 curve, ChaCha20-Poly1305, SHA3, and BLAKE2
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Sample SNAPI client"""
import hashlib
import os
import socket
from warnings import filterwarnings as filter_warnings
from cryptography.hazmat.primitives import hashes, serialization