Skip to content

Instantly share code, notes, and snippets.

View Hermann-SW's full-sized avatar

Hermann Stamm-Wilbrandt Hermann-SW

View GitHub Profile
""" pylinted, and code formatted with black """
from math import lcm
from cryptography.hazmat.primitives.asymmetric import rsa
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import serialization
# P and Q are prime factors of largest factored sofar RSA-250
#
P = 641352894770715802787901901705773890848250147429434472081168596 * 10**62
P += 32024532344630238623598752668347708737661925585694639798853367
@Hermann-SW
Hermann-SW / nohup.out.RSA-155
Created July 28, 2025 10:26
cado-nfs.py nohup output for factoring RSA-155 in 25:13h in total on 16C/32T AMD 7950X CPU with 32GB RAM
This file has been truncated, but you can view the full file.
Info:root: Using default parameter file ./parameters/factor/params.c155
Info:root: No database exists yet
Info:root: Created temporary directory /tmp/cado.10b02n9l
Info:Database: Database URI is db:sqlite3:///tmp/cado.10b02n9l/c155.db
Info:Database: Opened connection to database /tmp/cado.10b02n9l/c155.db
Info:root: Set tasks.linalg.bwc.threads=16 based on detected physical cores
Info:root: Set tasks.threads=32 based on detected logical cpus
Info:root: tasks.threads = 32 [via tasks.threads]
Info:root: tasks.polyselect.threads = 2 [via tasks.polyselect.threads]
@Hermann-SW
Hermann-SW / hip-magic.cpp
Created July 7, 2025 19:23
Compare single thread pure integer performance of CPUs and [AMD] GPUs
/*
Compare single thread pure integer performance of CPUs and [AMD] GPUs
hipcc hip-magic.hip
cpplint --filter=-legal/copyright hip-magic.hip.cpp
cppcheck --enable=all --suppress=missingIncludeSystem hip-magic.hip.cpp --check-config
*/
#include <sys/time.h>
#include <stdint.h>
#include <hip/hip_runtime.h>
@Hermann-SW
Hermann-SW / dummy.txt
Last active July 10, 2025 19:38
OpenCL example notes
see comments
@Hermann-SW
Hermann-SW / pcb442.cpp
Last active July 21, 2025 11:59
TSP Ruin and Recreate greedy implementation with random+sequential+radial ruins
//
// Developemnt of this gist is stopped, no further updates.
//
// This is the equivalent of this gist in new RR repo:
// https://github.com/Hermann-SW/RR/blob/main/tsp/greedy.cpp
//
// Code is split up, and a loader was added allowing for differnt problems.
// In addition that repo has 111 TSP problems with 108 corresponding
// optimal tours.
/*
@Hermann-SW
Hermann-SW / range_http.c
Created June 23, 2025 17:38
single threaded http server for distribution of disjoint bases from a range to geneferg on many CPUs/GPUs
/* based on:
https://medium.com/@justup1080/tutorial-creating-a-minimalist-http-server-in-c-2303d140c725
gcc -Wall -Wextra -pedantic range_http.c -o range_http
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <netinet/in.h>
@Hermann-SW
Hermann-SW / amdgpu_temp
Created June 11, 2025 20:08
Table display of three temperatures for all installed AMD GPUs every second
#!/bin/bash
d=$(find /sys/class/drm/card?/device/unique_id | wc --l)
printf "%9s" "$(hostname)"
for((c=0;c<d;++c))
do
printf "|%s" "$(cat /sys/class/drm/card$c/device/unique_id)"
done
echo "|"
@Hermann-SW
Hermann-SW / demo_executions.md
Last active June 1, 2025 09:47
Fast discrete log() allows factoring RSA semiprimes easily

See comment below.

@Hermann-SW
Hermann-SW / C60.Hamilton_Cycle.jscad
Created May 28, 2025 23:25
JSCAD script console.logs Mathematica command FindHamiltonianCycle[...], and displays its results in JSCAD
"use strict"
const jscad = require('@jscad/modeling')
const { translate, rotate, scale:scale3d } = jscad.transforms
const { vec3 } = jscad.maths
const { colorize } = jscad.colors
const { sphere, cylinder } = jscad.primitives
const { add, length, subtract, scale } = jscad.maths.vec3
const phi=(Math.sqrt(5)+1)/2;
const build=[[0,1,3*phi],[1,2+phi,2*phi],[phi,2,2*phi+1]];
@Hermann-SW
Hermann-SW / utility.jscad
Last active June 15, 2025 15:32
K_{3,3} embedded on a Möbius strip (with Bezier curve edges)
"use strict";
const jscad = require("@jscad/modeling");
const { vec2, vec3} = jscad.maths;
const { bezier} = jscad.curves;
const { rotate, scale, translate } = jscad.transforms;
const { cuboid, sphere, cylinder } = jscad.primitives;
const { colorize } = jscad.colors;
const r=40;
const w=20;