[DONE] Adding Sha256 support for authentication

(Ld57) #1

:bulb: Adding Sha256 support for authentication

it would be nice to add in roadmap the support of sha256, to complete sha1.

also maybe we could include a short executable to do that , in like “tools”.

for now on my side I did this script (powershell), but not sure if possible to convert that into java to compile for both windows and linux support.

:eyes: Example in powershell script

``` write-host “n" $name = Read-Host 'What to hash in sha1, sha256 and Base64 ?' write-host "n”
$sha1 = [System.Security.Cryptography.SHA1]::Create()
$sha256 = [System.Security.Cryptography.SHA256]::Create()
$bytes = [byte[]][char[]]$name
$encryptedBytessha1 = $sha1.ComputeHash($bytes)
$encryptedBytessha256 = $sha256.ComputeHash($bytes)
$encryptedBytessha1clean = $encryptedBytessha1 | foreach -Begin{$str=’’} -Process{$str += “{0:x2}” -f $} -End{$str}
$encryptedBytessha256clean = $encryptedBytessha256 | foreach -Begin{$str=’’} -Process{$str += “{0:x2}” -f $
} -End{$str}
write-host "String [$name] in SHA1 is [$encryptedBytessha1clean]"
write-host "String [$name] in SHA256 is [$encryptedBytessha256clean]"
write-host “`n”

$base64enc= [System.Text.Encoding]::UTF8.GetBytes($name)
$resultencoded= [System.Convert]::ToBase64String($base64enc)
Write-Host “String [$name] in Base64 is [$resultencoded]”

$base64dec = [System.Convert]::FromBase64String($resultencoded)
$resultdecoded =[System.Text.Encoding]::UTF8.GetString($base64dec)
Write-Host "[$resultdecoded] is that you originally input as string"
write-Host “`n”

##  🚀 Let's do this?
[poll type=number min=1 max=5 step=1 public=true]

(Simone Scarduzio) #2

Can you show the command line UX of this tool you wrote? I don’t have windows to run it, and I’d like to write a bash version for Mac/Linux to ship with the plugin. I really like the idea btw, super handy!


(Ld57) #3

Well, the bad thing is that it does not exist for linux, it is powershell, the integrated scripting system of windows product.
that s why we should adapt it to another language, which have to be OS independant ( like python or other ).

(Ld57) #4

I wil give a try on this. taking point.

(Simone Scarduzio) #5

Just committed the sha256 support in the master branch (v5.2), will port it soon to 2.x

(Ld57) #6

geez, too fast… :smile:

(Ld57) closed #7