Hi all,
Revisiting XOJO after many years, so effectively a noob (again).
I’ve been looking to hashing methods for password storage and have come across a great many posts that no longer work - either because everything is deprecated or because of compile errors.
Many methods that rely on text now expect strings, but equivalent methods do not seem to exist. Where deprecated I cannot find what these are replaced with.
Specifically, I was looking at: Tips: Dealing with the Problem of Passwords – Xojo Programming Blog. The sample file in this blog post (http://files.xojo.com/BlogExamples/PasswordHashing.xojo_binary_project) fails to run. It was trivial to fix the error in the ConvertToHex
method by adding a .toText
to the end of the line being looped. This works but is deprecated and I can’t see what this should be replaced with.
While the code works, almost every line is giving a depracation warning because of:
Core.TextEncoding.ConvertTextToData(value As Text, allowLossy As Boolean = False) As xojo.Core.MemoryBlock
string.toText
Xojo.Crypto
I tried to replace what I could to make get rid of the great number of warnings, but nothing works.
Does anyone have any suggestions on how to modernise:
Dim password As text = PasswordField.Text.ToText
Dim passwordData As Xojo.Core.MemoryBlock
passwordData = Xojo.Core.TextEncoding.UTF8.ConvertTextToData(password)
where .toText
and ConvertTextToData
are deprecated and with no obvious (to me) replacement? while some can be of string type instead, this doesn’t work with subsequent functions, causing an error.
the line
hashData = Xojo.Crypto.Hash(combinedData, Xojo.Crypto.HashAlgorithms.MD5)
is valid but deprecated.
What seemed the obvious to me to update this would be to change this to
hashData = Crypto.Hash(combinedData, Crypto.HashAlgorithms.MD5)
but this causes an error rather than a warning:
There is more than one method with this name but this does not match any of the available signatures.
yet the ‘signature’ appears correct:
Crypto.Hash(data As MemoryBlock, hashAlgorithm As HashAlgorithms) As MemoryBlock
I cannot find a resource to explain what all the deprecations should be replaced with, and to say this is confusing is an understatement…
Grateful for pointers/suggestions/help,
Stam