PDA

View Full Version : new Gost_-functions 1.9.15



ReneMiner
15-02-2015, 08:28
in "what's New" in helpfile of v. 1.9.15 there are a few new core-functions as Gost_Keygen, Gost_Encrypt and Gost_Decrypt but i can not find anything about sense, usage nor syntax. I want to try out but i need an idea what it does...

What are they good for? What is a "Gost"?
Is it a typo and missing the "h" - so should be "Ghost_"?

ErosOlmi
15-02-2015, 11:01
Ciao Renč,

you are right I didn't create any example.

Here a little example.
Attention: there is a bug I will fix next version: decrypted string contains some null at the end. SO you need to RTRIM$ nulls to have original string back.


Uses "Console"

'---A string you would like to encript
String sToEncrypt = "A string to encrypt xxxxx"


'---A key to use to later decrypt the string
'---You can create your key or ask for a key
String Gost_Key = "My Key"
'String Gost_Key = Gost_KeyGen




String sEncrypted
String sOriginal


sEncrypted = Gost_Encrypt(sToEncrypt, Gost_Key)
'sOriginal = Gost_Decrypt(sEncrypted, Gost_Key)
sOriginal = RTrim$(Gost_Decrypt(sEncrypted, Gost_Key), $NUL)

PrintL "String to encrypt: " & sToEncrypt
PrintL "Using key: " & Gost_Key
PrintL "Encrypted: " & sEncrypted
PrintL "Decrypted: [" & sOriginal & "]"


WaitKey




Reference: http://en.wikipedia.org/wiki/GOST_(block_cipher)
PB sources from which I started: http://www.powerbasic.com/support/pbforums/showthread.php?t=23531

It is useful to encrypt string data representing standard text not too big (less than 3 or 4k) otherwise quite slow.
I use to encrypt keys or little piece of data I want to protect.