{"id":37192949,"url":"https://github.com/sa6mwa/krypto431","last_synced_at":"2026-01-14T22:23:39.385Z","repository":{"id":65339040,"uuid":"359106552","full_name":"sa6mwa/krypto431","owner":"sa6mwa","description":"Krypto431 is a Computer-Aided DIANA-based Cryptosystem (CADCRYS) interfacing human One Time Pad (OTP) ciphering with machines.","archived":false,"fork":false,"pushed_at":"2024-01-03T12:55:25.000Z","size":3079,"stargazers_count":0,"open_issues_count":8,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-06-20T05:10:55.519Z","etag":null,"topics":["ciphers","ciphertext","one-time-pad","one-time-pad-cipher"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sa6mwa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-04-18T10:04:13.000Z","updated_at":"2023-01-10T18:27:56.000Z","dependencies_parsed_at":"2024-06-20T04:23:48.238Z","dependency_job_id":"98589750-13bc-4138-8c0c-1a1b3791b915","html_url":"https://github.com/sa6mwa/krypto431","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/sa6mwa/krypto431","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sa6mwa%2Fkrypto431","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sa6mwa%2Fkrypto431/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sa6mwa%2Fkrypto431/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sa6mwa%2Fkrypto431/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sa6mwa","download_url":"https://codeload.github.com/sa6mwa/krypto431/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sa6mwa%2Fkrypto431/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28436296,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T21:32:52.117Z","status":"ssl_error","status_checked_at":"2026-01-14T21:32:33.442Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ciphers","ciphertext","one-time-pad","one-time-pad-cipher"],"created_at":"2026-01-14T22:23:38.470Z","updated_at":"2026-01-14T22:23:39.373Z","avatar_url":"https://github.com/sa6mwa.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Krypto431\n\nProject Krypto431 is a simple OTP (One Time Pad) based on the DIANA cryptosystem\nutilizing a reciprocal table with single-use keys. Krypto431 is both a CLI\n(command-line interface) tool and a traditional pen-and-paper cipher. The tool\nis provided for Linux, BSD-derivatives and Windows.\n\n## Purpose\n\nKrypto431 was designed to ease and facility passing sensitive information over\nany mode of communication, with or without electronic equipment. Although the\nsystem can be managed without a computer, the tool is an aid to generate,\nmanage, and distribute keys to multiple stations and also simplify the message\nexchange (encoding, enciphering, deciphering, and decoding).\n\nNaturally, the intended particular purpose of this type of cipher is to encrypt\nmessages in a contested (electronically and otherwise) hostile environment.\nStations can be fully *within* enemy lines (civilian resistance movement) as\nwell as *beyond* enemy lines (armed resistance, remote reconnaissance, etc).\nAnother obvious purpose would be to encrypt sensitive information (such as\ncasualties, names, addresses for example) during emergency communication.\n\nAlthough primarily not intended for amateur radio, we are allowed to exchange\nencrypted messages over ham radio within Sweden as long as our call-signs can be\ndecoded. This allows us to practice sending and receiving old-style radiogram\nformatted crypto-group messages over telegraphy as well as voice, RTTY or a more\nmodern data mode of choice.\n\n## Status\n\nCurrent version (v0.1.x) is a **proof-of-concept** and a pre-release to\ndemonstrate the idea. Version 0.2 will include (aside from bug-fixes) printable\ninstructions how to encipher, decipher, distribute keys, generating a key with\ndice. Support for binary file transfer will be included in v0.3.\n\n## Installation\n\nBinaries are provided in the release tarball (zip) for various operating systems\nand architectures. If you have [Go](https://go.dev) installed, you can download\nand build the CLI tool with this oneliner...\n\n```console\ngo install github.com/sa6mwa/krypto431/cmd/krypto431@latest\n```\n\n## Examples\n\nRead ahead how to encipher/decipher by hand and further information. Crude\nexamples of current version...\n\n```\n$ ./krypto431 messages -n\nEnter decryption key: \nMessage header as well as text body is entered as a radiogram according to the\nfollowing simplified ACP 124 radiotelegraph message format:\nTO1 TO2 TO3 DE FROM 012345 = Hello, this is the body of the message = K\nDE FROM This is the shortest form.\nTO DE FROM 012345ZDEC22 COL 3 = ABCDE FGHIJ KLMNO = K\nTO DE FROM 012345 == TO2 TO3 == COL 2 = Hello world K\nTO DE FROM 012345 C = This is a broadcast message. +\nDE FROM 012345 4 = ABCDE FGHIJ KLMNO QRSTU = K\n*) TO is(/are) the call-sign(s) of the recipient(s).\n   FROM is your call-sign.\n   012345 is a Date-Time Group (day hour minute, full format DDHHMMZmmmYY).\n? Enter message as radiogram (your call is SA6MWA) [Enter 2 empty lines to finish]\nqj de sa6mwa Hello world, this is a short message. = K\n________________________________________________________________________________\n082223AJAN23             TO: QJ\nID: C7X9          FROM (DE): SA6MWA\n=TEXT=\nHello world, this is a short message.\n=CIPHER=\nPHPSN DLAUC VESIM SEIYG NBOBP CIAMS JHZIA BGBGG CIYAU CKMNM\n=TRAFFIC=EXAMPLE=\nQJ DE SA6MWA 082223AJAN23 10 = PHPSN DLAUC VESIM SEIYG NBOBP CIAMS JHZIA BGBGG\nCIYAU CKMNM = K\n\nSaved message C7X9 in /home/sa6mwa/.krypto431.gob.\n\n\n$ krypto431 keys -k qj -o keysToGiveToQJ.pdf\n...\n\n$ ./krypto431 keys -k qj -E keysToQJ.gob\nEnter decryption key: \nExported 10 keys from /home/sa6mwa/.krypto431.gob to keysToQJ.gob (change PFK/salt with the pfk command).\n```\n\n### Initialization\n\nKrypto431 uses (per default) an encrypted GOB (Go Binary) file under your home\nfolder named `.krypto431.gob`. See `krypto431 -h` and `krypto431 pfk -h` for\nfull information on how to manage these key and message stores.\n\n```console\n# For help: krypto431 init -h\n\n$ krypto431 init\n? Enter your call-sign: sa6mwa\n? Enter number of initial keys to generate: 10\n? Enter keepers of the initial keys (leave empty for anonymous): qj\n? Enter expiry date as a Date-Time Group or empty for default: 101500ZFEB23\n? Choose length of keys: 350\n? Choose group size: 5\n? Overwrite /home/sa6mwa/.krypto431.gob? Yes\nEnter encryption key: \nDenied: insecure password, try including more special characters or using a longer password (42\u003c60)\nEnter encryption key: \nOK: Password entropy is 97\nEnter encryption key: (repeat) \nSaved /home/sa6mwa/.krypto431.gob\n```\n\n## Case\n\nOne Time Pad (OTP) ciphers are pretty simple and straight forward, but in order\nto be able to communicate, encrypt and decrypt messages you need to agree on a\nformat, consider key distribution and provide clear instructions how to use such\na system. If there ever is a need to pass sensitive information in a short\nmessage format over an unsecure channel (for example over radio telegraphy or\nradio telephony), there are no open civilian solutions readily available.\nKrypto431 was realized to provide a standard and a set of tools for effectively\npassing encrypted messages that can - if necessary - be deciphered (and\nenciphered) without an electronic or a mechanical device.\n\n431 is the sum of all ascii characters in my amateur radio callsign SA6MWA. As\nthe name suggests, the concept is to add or subtract in order to encrypt or\ndecrypt a text message. The system is designed to be easy to use without any\nelectronic equipment, just pen and paper.\n\n## How\n\nTraditionally, ciphertext has consisted of groups of 5 letters where the first\ngroup identifies the key. When sending such a ciphertext (in for example\nmilitary radio communication) you indicate group count - how many groups of 5\nletters there are to be sent/received. Krypto431 employs the same concept. The\nfirst group consists of 5 letters that identify which key was used to encrypt\nit and - since it's symmetric - which key to use for decrypting the ciphertext.\nThe remaining ciphertext is organized into groups of 5 letters.\n\nWhen encrypting, you add the numerical representation of the letter (for\nexample A=0) with the randomly generated number from the key. If the number is\n26 or above, you wrap it starting from 0 (modulo 26).\n\nWhen decrypting, you subtract the random number in the key from the ciphered\nnumerical representation of the letter. If the number is negative, you wrap it\naround starting from 26 (or, for example 4 minus number from the key, e.g 18 =\n`(26+4-18)%26 = 12 = L`).\n\nIf the encryptor has enciphered the whole message and is left with a final\ngroup of less than 5 letters, the encryptor should add Z to the plaintext to\nfill up any remaining group as Z will be used as an operator character that\nchanges the character table to and from an alternate table. Filling up with Z\njust changes the table back and forth without adding any real characters to the\noutput.\n\n## DIANA APPROACH\n\nKrypto431 will utilize the NSA cipher codenamed DIANA mainly used by US Special\nForces during the Vietnam war.\n\nThe US DIANA cipher uses a trigraph designed so that you use the same column\nfor both encryption and decryption. This is achieved by having an alphabeth in\nreverse (Z to A) of the normal alphabeth sequence (A to Z).\n\nRead more here \u003chttp://users.telenet.be/d.rijmenants/en/onetimepad.htm\u003e.\n\nThe trigraph...\n\n```\n0  1  2  3  4  5  6  7  8  9  10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25\nA  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z\n-----------------------------------------------------------------------------\nAz Ay Ax Aw Av Au At As Ar Aq Ap Ao An Am Al Ak Aj Ai Ah Ag Af Ae Ad Ac Ab Aa\nBy Bx Bw Bv Bu Bt Bs Br Bq Bp Bo Bn Bm Bl Bk Bj Bi Bh Bg Bf Be Bd Bc Bb Ba Bz\nCx Cw Cv Cu Ct Cs Cr Cq Cp Co Cn Cm Cl Ck Cj Ci Ch Cg Cf Ce Cd Cc Cb Ca Cz Cy\nDw Dv Du Dt Ds Dr Dq Dp Do Dn Dm Dl Dk Dj Di Dh Dg Df De Dd Dc Db Da Dz Dy Dx\nEv Eu Et Es Er Eq Ep Eo En Em El Ek Ej Ei Eh Eg Ef Ee Ed Ec Eb Ea Ez Ey Ex Ew\nFu Ft Fs Fr Fq Fp Fo Fn Fm Fl Fk Fj Fi Fh Fg Ff Fe Fd Fc Fb Fa Fz Fy Fx Fw Fv\nGt Gs Gr Gq Gp Go Gn Gm Gl Gk Gj Gi Gh Gg Gf Ge Gd Gc Gb Ga Gz Gy Gx Gw Gv Gu\nHs Hr Hq Hp Ho Hn Hm Hl Hk Hj Hi Hh Hg Hf He Hd Hc Hb Ha Hz Hy Hx Hw Hv Hu Ht\nIr Iq Ip Io In Im Il Ik Ij Ii Ih Ig If Ie Id Ic Ib Ia Iz Iy Ix Iw Iv Iu It Is\nJq Jp Jo Jn Jm Jl Jk Jj Ji Jh Jg Jf Je Jd Jc Jb Ja Jz Jy Jx Jw Jv Ju Jt Js Jr\nKp Ko Kn Km Kl Kk Kj Ki Kh Kg Kf Ke Kd Kc Kb Ka Kz Ky Kx Kw Kv Ku Kt Ks Kr Kq\nLo Ln Lm Ll Lk Lj Li Lh Lg Lf Le Ld Lc Lb La Lz Ly Lx Lw Lv Lu Lt Ls Lr Lq Lp\nMn Mm Ml Mk Mj Mi Mh Mg Mf Me Md Mc Mb Ma Mz My Mx Mw Mv Mu Mt Ms Mr Mq Mp Mo\nNm Nl Nk Nj Ni Nh Ng Nf Ne Nd Nc Nb Na Nz Ny Nx Nw Nv Nu Nt Ns Nr Nq Np No Nn\nOl Ok Oj Oi Oh Og Of Oe Od Oc Ob Oa Oz Oy Ox Ow Ov Ou Ot Os Or Oq Op Oo On Om\nPk Pj Pi Ph Pg Pf Pe Pd Pc Pb Pa Pz Py Px Pw Pv Pu Pt Ps Pr Pq Pp Po Pn Pm Pl\nQj Qi Qh Qg Qf Qe Qd Qc Qb Qa Qz Qy Qx Qw Qv Qu Qt Qs Qr Qq Qp Qo Qn Qm Ql Qk\nRi Rh Rg Rf Re Rd Rc Rb Ra Rz Ry Rx Rw Rv Ru Rt Rs Rr Rq Rp Ro Rn Rm Rl Rk Rj\nSh Sg Sf Se Sd Sc Sb Sa Sz Sy Sx Sw Sv Su St Ss Sr Sq Sp So Sn Sm Sl Sk Sj Si\nTg Tf Te Td Tc Tb Ta Tz Ty Tx Tw Tv Tu Tt Ts Tr Tq Tp To Tn Tm Tl Tk Tj Ti Th\nUf Ue Ud Uc Ub Ua Uz Uy Ux Uw Uv Uu Ut Us Ur Uq Up Uo Un Um Ul Uk Uj Ui Uh Ug\nVe Vd Vc Vb Va Vz Vy Vx Vw Vv Vu Vt Vs Vr Vq Vp Vo Vn Vm Vl Vk Vj Vi Vh Vg Vf\nWd Wc Wb Wa Wz Wy Wx Ww Wv Wu Wt Ws Wr Wq Wp Wo Wn Wm Wl Wk Wj Wi Wh Wg Wf We\nXc Xb Xa Xz Xy Xx Xw Xv Xu Xt Xs Xr Xq Xp Xo Xn Xm Xl Xk Xj Xi Xh Xg Xf Xe Xd\nYb Ya Yz Yy Yx Yw Yv Yu Yt Ys Yr Yq Yp Yo Yn Ym Yl Yk Yj Yi Yh Yg Yf Ye Yd Yc\nZa Zz Zy Zx Zw Zv Zu Zt Zs Zr Zq Zp Zo Zn Zm Zl Zk Zj Zi Zh Zg Zf Ze Zd Zc Zb\n\n   Message: HELLO WORLD\nRandom key: YNQCI CPWZH\nCiphertext: UIYMD BWMPP\n\nENCRYPT\nTake the letter from Message (first is H), find it in the first row above (the\nrow with A to Z in capital letters). You now have your column. Find the key\nletter i upper case (Y) in the column and you see the bigram \"Yu\". The letter\nto write as ciphertext is the one in lower case (u).\n\nDECRYPT\nTake the letter from Ciphertext (first is U), find it in the first row above\n(the row with A to Z in capital letters). You now have your column.  Find the\nkey letter in upper case (Y) in the column and you see the bigram \"Yh\". The\nletter to write as plaintext is the one in lower case (h).\n\nThis is very convenient - encryption and decryption uses exactly the same\nprocedure: plaintext with key for encrypt, ciphertext with key for decrypt -\nsame row and column procedure.\n\nForgot whether the letter of the message or the key should be used as row or\ncolumn? No problem! The really cool thing is that it does not matter if you use\nthe letter from the message or the letter from the key as row (or column). You\ncan mix them up, and it's OK, the result will be the same - for both encryption\nand decryption.\n\nUnlike with simple modulo 26, a zero-key encryption (key consists of only A)\ndoes not work, instead each letter has to be coded aaccording to both forward\nand reverse position of the text and we end up with...\n\n   Message: HELLO WORLD\n       Key: LRDDX HXRDT\nCipherText: HELLO WORLD\n\n\nAnother arrangement of the trigraph...\n\n  A B C D E F G H I J K L M N O P Q R S T U V W X Y Z\n ----------------------------------------------------\nA A A A A A A A A A A A A A A A A A A A A A A A A A A\n  Z Y X W V U T S R Q P O N M L K J I H G F E D C B A\n\nB B B B B B B B B B B B B B B B B B B B B B B B B B B\n  Y X W V U T S R Q P O N M L K J I H G F E D C B A Z\n\nC C C C C C C C C C C C C C C C C C C C C C C C C C C\n  X W V U T S R Q P O N M L K J I H G F E D C B A Z Y\n\nD D D D D D D D D D D D D D D D D D D D D D D D D D D\n  W V U T S R Q P O N M L K J I H G F E D C B A Z Y X\n\nE E E E E E E E E E E E E E E E E E E E E E E E E E E\n  V U T S R Q P O N M L K J I H G F E D C B A Z Y X W\n\nF F F F F F F F F F F F F F F F F F F F F F F F F F F\n  U T S R Q P O N M L K J I H G F E D C B A Z Y X W V\n\nG G G G G G G G G G G G G G G G G G G G G G G G G G G\n  T S R Q P O N M L K J I H G F E D C B A Z Y X W V U\n\nH H H H H H H H H H H H H H H H H H H H H H H H H H H\n  S R Q P O N M L K J I H G F E D C B A Z Y X W V U T\n\nI I I I I I I I I I I I I I I I I I I I I I I I I I I\n  R Q P O N M L K J I H G F E D C B A Z Y X W V U T S\n\nJ J J J J J J J J J J J J J J J J J J J J J J J J J J\n  Q P O N M L K J I H G F E D C B A Z Y X W V U T S R\n\nK K K K K K K K K K K K K K K K K K K K K K K K K K K\n  P O N M L K J I H G F E D C B A Z Y X W V U T S R Q\n\nL L L L L L L L L L L L L L L L L L L L L L L L L L L\n  O N M L K J I H G F E D C B A Z Y X W V U T S R Q P\n\nM M M M M M M M M M M M M M M M M M M M M M M M M M M \n  N M L K J I H G F E D C B A Z Y X W V U T S R Q P O\n\nN N N N N N N N N N N N N N N N N N N N N N N N N N N\n  M L K J I H G F E D C B A Z Y X W V U T S R Q P O N\n\nO O O O O O O O O O O O O O O O O O O O O O O O O O O\n  L K J I H G F E D C B A Z Y X W V U T S R Q P O N M\n\nP P P P P P P P P P P P P P P P P P P P P P P P P P P\n  K J I H G F E D C B A Z Y X W V U T S R Q P O N M L\n\nQ Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q\n  J I H G F E D C B A Z Y X W V U T S R Q P O N M L K\n\nR R R R R R R R R R R R R R R R R R R R R R R R R R R\n  I H G F E D C B A Z Y X W V U T S R Q P O N M L K J\n\nS S S S S S S S S S S S S S S S S S S S S S S S S S S\n  H G F E D C B A Z Y X W V U T S R Q P O N M L K J I\n\nT T T T T T T T T T T T T T T T T T T T T T T T T T T\n  G F E D C B A Z Y X W V U T S R Q P O N M L K J I H\n\nU U U U U U U U U U U U U U U U U U U U U U U U U U U\n  F E D C B A Z Y X W V U T S R Q P O N M L K J I H G\n\nV V V V V V V V V V V V V V V V V V V V V V V V V V V\n  E D C B A Z Y X W V U T S R Q P O N M L K J I H G F\n\nW W W W W W W W W W W W W W W W W W W W W W W W W W W\n  D C B A Z Y X W V U T S R Q P O N M L K J I H G F E\n\nX X X X X X X X X X X X X X X X X X X X X X X X X X X\n  C B A Z Y X W V U T S R Q P O N M L K J I H G F E D\n\nY Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y\n  B A Z Y X W V U T S R Q P O N M L K J I H G F E D C\n\nZ Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z\n  A Z Y X W V U T S R Q P O N M L K J I H G F E D C B\n```\n\n\n## Manually generating a key with dice\n\nThe previous method described here had the flaw of bias towards some numbers\nwhile others do not appear as frequent resulting in a poor quality key -\nthankfully pointed out by SA4AMX.\n\nOne possible solution was found\n[here](https://medium.com/swlh/simulating-a-seven-sided-die-with-a-six-sided-one-28f73afc1702),\nbut it needs to be described dumb-simple for numbers 0 to 25.\n[Here](https://medium.com/swlh/roll-your-own-random-number-generator-176bcd860363)\nThomas Langkaas explains some more.\n\n```\ntldr; Use 2 cube dices (6-sided). First roll selects range of second throw.\n1  1  1  1  1  1  2  2  2  2  2  2  3  3  3  3  3  3  4  4  4  4  4  4  5  5\n1  2  3  4  5  6  1  2  3  4  5  6  1  2  3  4  5  6  1  2  3  4  5  6  1  2\n00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25\n\nIf first roll of the dice is a 3 and second roll is a 4, the random number is\n15. If the first throw is a 6 you simply discard it and roll the dice again.\nSame thing if the first roll is a 5 and the second roll is 3, 4, 5 or 6 - you\nre-roll until you get either 1 or 2. If the first roll is 5 and the second\nis 1 the number is 24. If the first roll is 5 and the second is 2 the number is\n25.\n```\n\n## Randomness\n\nKrypto431 will use `crypto/rand` in the Golang implementation which in turn\nprefer `getrandom(2)` on Linux systems or `/dev/urandom` as a fallback. We can\nsafely use `/dev/urandom` as it uses the exact same CSPRNG (Cryptographically\nSecure Pseudo Random Number Generator) as `/dev/random`. Entropy is not an\nissue if you have enough to start with (256 bits) and this program will not run\nat boot at the exact same time as a virtual machine that uses the exact same\nseed on every boot. So the issue with using `/dev/urandom` does not exist. By\nusing `crypto/rand` on a Linux system above 3.17 (or something) we use\n`getrandom(2)` which will block until enough initial entropy has been gathered\nand will never block again - exactly what we want.\n\nReference: \u003chttps://www.2uo.de/myths-about-urandom/\u003e\n\n\n## Secure key generation\n\nLinks to things related to cryptographically secure PRNG/RNG and \n\n* Implement Lemire's debiased integer multiplication method? \u003chttps://www.pcg-random.org/posts/bounded-rands.html\u003e\n* LICENSE ISSUE (GPL-3.0): Pure Go implementation of Mersenne Twister PRNG \u003chttps://pkg.go.dev/github.com/seehuhn/mt19937\u003e\n* MIT License MT19937 version: \u003chttps://github.com/spiegel-im-spiegel/mt\u003e \n\nThe Go `math/rand` PRNG is said to be from Plan9's rand(2) implementation and\nis an **Additive Lagged Fibonacci Generator (ALFG)** which is not considered\nsecure by todays standards.\n\u003chttps://en.wikipedia.org/wiki/Lagged_Fibonacci_generator\u003e.\n\n```\nIt's an Additive Lagged Fibonacci Generator (ALFG)\ndescribed by S_n ≡ S_(n-273) + S_(n-607) mod 2^31.\nIt's the same code used in Plan 9's rand(2).\n```\n[Source](https://grokbase.com/t/gg/golang-nuts/137fejwsem/go-nuts-math-rand-package-underlying-algorithm#20130715lfzbivfzx6567dx7vz3babsvvu)\n\nUsing [Stefan Nilsson's approach](https://yourbasic.org/golang/crypto-rand-int/) by initiating a new source (not NewSource, but New(source)) makes it possible to use `math/rand` with an external pseudo random number generator (for example `crypto/rand` which is cryptographically secure).\n\n```go\n// A Source represents a source of uniformly-distributed\n// pseudo-random int64 values in the range [0, 1\u003c\u003c63).\ntype Source interface {\n\tInt63() int64\n\tSeed(seed int64)\n}\n\n// A Source64 is a Source that can also generate\n// uniformly-distributed pseudo-random uint64 values in\n// the range [0, 1\u003c\u003c64) directly.\n// If a Rand r's underlying Source s implements Source64,\n// then r.Uint64 returns the result of one call to s.Uint64\n// instead of making two calls to s.Int63.\ntype Source64 interface {\n\tSource\n\tUint64() uint64\n}\n\n/* ... */\n\n// New returns a new Rand that uses random values from src\n// to generate other random values.\nfunc New(src Source) *Rand {\n\ts64, _ := src.(Source64)\n\treturn \u0026Rand{src: src, s64: s64}\n}\n```\n\nSo we need at least `Int63()` and `Seed()`. Usually we can get a Uint64 and\nmask off a bit to get the `Int63()`, which is what Stefan\nNilsson's implementation does.\n\nThe `Seed()` function can be completely empty in this case as it's already\nseeded by the operating system through `crypto/rand`.\n\n## Other links\n\n\u003chttps://youtu.be/cpqwp2H0SNo\u003e\n\n## 431\n\n```\nX=0 ; for i in $(echo -n SA6MWA | hexdump -e '1/1 \"%d \"'); do let X=$X+$i ; done ; echo $X\n431\n\n# or...\n\necho -n SA6MWA | sum -s\n431 1\n```\n\n# Authors\n\nSee the  `AUTHORS` file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsa6mwa%2Fkrypto431","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsa6mwa%2Fkrypto431","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsa6mwa%2Fkrypto431/lists"}