Generating WordPress salts in Go
One of the things I want to achieve in 2018 is to learn to use Go.
WordPress has a salt generator that is referenced in their stock wp-config.php
file right here: https://api.wordpress.org/secret-key/1.1/salt/
It’s useful, but only provides salts in the php way:
define( 'NAME', 'value' );
However I use a lot of .env
files, and generally environment windows while managing servers, and reformatting that, while not super hard, is tedious.
So obviously I spent like a week to write something in Go that would do this for me, and published it while I was at it.
PHP
https://wpsaltdotenv.herokuapp.com/
define( 'AUTH_KEY', 'DmkLr?rb9(a;R]EE|7e] S#R0}:ubH{Al55& Ys[5)=(; ]WYU1{v+emy,elr}2:' );
define( 'SECURE_AUTH_KEY', 'p93~5y?Hq?#2/`|;@C`|nwTt%UuXZ~rx2ez{tgsna#Phtn]4OJCx}jevQy(J7KPm' );
define( 'LOGGED_IN_KEY', 'Ocu<?w:R z/<9k?L#qQ#GIp;>3|WF%w,5%?8:<qdoV^_zU6M0]~v@D0j5v~=10<_' );
define( 'NONCE_KEY', 'r;kF>)Tk@+`86!f7tloqdM)0w8,4YeU1u Ynf-4rgg,_y#bBMXH+;3v7@aB>b3l7' );
define( 'AUTH_SALT', 'xBNNf@Mxo)CnwcB_>`?FE)2#k2o^Pk5y1:iVtaE6,V`Tz*YxDF+sueA~eom:BeI0' );
define( 'SECURE_AUTH_SALT', '_=7x#x}}~H.J{cl`UEv77y(r9<a0s>hDG.`ys/r)(9s-hW-O[f{ t+3_2}ScvZRH' );
define( 'LOGGED_IN_SALT', 'Mscfgb,n;VgpN|1wPq@#Ec2 GiyTh)ehZ9TFyt3Y6eSZ3[`YVC{IB0_}6ge|xs[&' );
define( 'NONCE_SALT', 'K0,e3KpQ})Q9-G~-zbFVQ7vm46,jp;Zz`+qViA;|@qztBr#.;ck(JF,^1 8EH}]:' );
.env
https://wpsaltdotenv.herokuapp.com/env
AUTH_KEY="}Vv2pV:(*a9u^DxsD?Hc.P.,Dyz3*O/,^rkfOC`y<yQ:n2pD/<E4P:~S<f,e~ukR"
SECURE_AUTH_KEY="-:-UqQAR95]9BW>iOktP/=?R5ASJX#q ?>At+x<s<y&3MX|ylGo5rzWw<z?,8VL_"
LOGGED_IN_KEY="Y?%2~MTfo}PkigU<fTP{N8LTt/{#Ml8bNVM,k9hK_y>Kd-bd#cRJj_b;Y@:50p>]"
NONCE_KEY="YoofupnHYL`gpFzU9hq]hV0[uiX4f%Tp.@vm~^<]jGi+K9J0*ZR%<Wrc{x,..oXR"
AUTH_SALT="O;85aljE@`+tDF96r090P6e DwCApAT8Cg`,M#If`lF%hT9q?ings }6l7G7G4{j"
SECURE_AUTH_SALT="7}@oTX`>ECMVHE]Us`CvlyX_n-QW;Ig*Zab4.TdF06z!>%}Or>qN%ucDtVC%Z &V"
LOGGED_IN_SALT="nsZf4Je3IV<Wu)KyiR0Z([Q&=n0-xD:vu{l~k|_o)uI=@LxM)[qnjzsldteE[~M!"
NONCE_SALT="hGXB7}Z-jJ.#CCwh=qa?5qcf2L8UA{kB{<deBfNPP+A@(~ZU.:)?B j8niy2<gNw"
JSON
https://wpsaltdotenv.herokuapp.com/json
{"AUTH_KEY":"0;}E/H4G\u0026]p2Zz-?UX=]1K}XW-:6D6F/,gTr_DK]~emgwLGs_+ji]\u00269\u003eP+_\u003e8uF)","AUTH_SALT":"1rh{tt2j+-VBSCB~d(q9X27a C%gd+X5Y%|Wi69TGu..;L N.,~Qv3W|X6R6g:n-","LOGGED_IN_KEY":"{kv`Jrq{o?FQxXD`#j\u003c|a![A{Uz9~,;!BY5,mK5l0e.QaT-w`m_YJz1wyxPsvMl{","LOGGED_IN_SALT":"H_^R3EmglT1\u003cRK2;IF\u0026!!RazfxY4)+VtQIIZb/AisvT@A12\u003ev?zh.{FN4iwU~SJ0","NONCE_KEY":"OZ^]A42|3;-w\u003cK_eH@\u0026QIackKxJt- 8\u0026x?zTTv)P!:.b|Xt{Rg ?oAVfsc(TauB\u003c","NONCE_SALT":"MV\u003ct~r].(y=3s(%OHws[B/t,18{{9+jT{cZH*#cbOnz?f7N7;L/XJ(8`0lyrA**k","SECURE_AUTH_KEY":"o~y~Lw6,NshWJv\u003cS0Ec.*xfF|*OB:XmsEzC3kh*3}h-Ys:4u/,:XfV):U\u003cwVb!pj","SECURE_AUTH_SALT":"6n[(9mxj:UnqEuCBFi\u003er1%~LH[5:XjZdU~ySzaG8Z1uZ1p0b-\u003e7^;\u0026%-P1(%H:j4"}
It’s also SUPER FAST, as in, when stress testing it on my local computer, it spent ~48% of the time doing system calls. So yah...
Also, here’s the Githubs: https://github.com/javorszky/go-generate-salts
Props to my brother 🙌
Photo by sebastiaan stam on Unsplash