You probably saw this: % openssl genrsa -out keypair.pem 512 % openssl rsa -noout -text -in keypair.pem RSA Private-Key: (512 bit, 2 primes) modulus: 00:fd:1a:2f:5a:b9:01:4f:85:f7:72:a4:c2:6f:58: 43:c8:6a:4c:dc:2b:3f:96:08:8e:e9:ed:4e:c2:92: e4:3c:02:c8:2e:09:63:23:ad:45:6b:92:fa:a7:88: 3a:0c:4b:08:cf:aa:fd:b5:64:cd:28:5e:3a:6a:53:...

16h

For this example, I devised my own hash function. It's SHA2-224, but I use only 32 bits. Quick question, what this code will print? #!/usr/bin/env python3 import hashlib from collections import defaultdict def my_hash(s): m = hashlib.sha224() m.update(s.encode('utf-8')) return int.from_bytes(m.digest()[0:4], byteorder='big')...

3d

This is a real piece of SageMath/Python code (Jupyter) I devised for the example. Jupyter exported HTML. Three 4096-bit RSA keys, but (public) exponent is too low - 3. If the same message was encrypted to these 3 keys, the message can be recovered. Let's see, how it works. Chinese Remainder Theorem states, that for a system of equation......

3d

My Discord server/channels

4d

Once I was happy with Password Safe, but I wanted something even simpler. Here is my solution I use daily. You only have to memorize your master password. The following script can be publically available to anyone. Run it, enter master password and your generated password is pushed to clipboard(s). #!/usr/bin/env bash read -p "Enter...

1w

As a very worrisome neurotic I always been wondering, can I get my internal Uber statistics based only on rating(s)? Hard to believe, but yes. But you should get as many ratings as possible, an interrupted 'chain' of ratings. Also, you need to predict a minimal and maximal number of ratings you've got. Taxi drivers don't always rate their...

2w

Many noob Lispers, including myself, have a hard time understanding, what is proper tail call/recursion/optimization, and what is not. Here is some code I've stole from Wikipedia. (Rewritten to pure C.) #include <stdio.h> int fact_iter(int n, int a) { if (n==0) return a; return fact_iter(n-1, n*a);...

2w

First part: ElGamal encryption system, cracking it using CADO-NFS All variable names as in Wikipedia's explanation of ElGamal signing scheme. As in ElGamal encryption scheme, we reuse these parameters and keys: g, p are public parameters. x, y are keys. x - private, y - public. Let m be a message. Generate 'ephemeral...

3w

ElGamal encryption system shares a lot with Diffie–Hellman key exchange, so please read my previous blog post about it first, Toy example All variable names are the same as in the Wikipedia article. Generate g/p parameters as for Diffie-Hellman scheme. (g is generator, p is a prime.) #!/usr/bin/env python3 import random, math...

3w

Now we need to add a circle to our clock. Circle is defined by Pythagorean theorem: $x^2 + y^2 = r^2$, where $x$ and $y$ -- coordinates on plain and $r$ is radius. Naive algorithm So let's draw it! Enumerate all points in 0..radius range and find "height" for each point. Height will be $\sqrt{r^2 - y^2}$ We will draw only a quadrant,...

Apr 2022

Follow RSS Feeds, Blogs, Podcasts, Twitter searches, Facebook pages, even Email Newsletters! Get unfiltered news feeds or filter them to your liking.

Get Inoreader