This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

How to encryp a string in godot?
I know how to save a string to file with encrypting but I dont know how to do it without saving any file. Is there is any way?

Godot version 3.5.1
in Engine by (47 points)

1 Answer

+1 vote

Depending on the details of your use-case, there are a number of cryptographic'ish methods available for the String class. For example, hash(), md5_text(), sha1_text(), and sha256_text(). All will allow you to convert a plain-text string into some form of hashed representation...

Maybe one of those will suit your needs?

String docs here:

by (22,704 points)

Thank you. But for example I used md5_text for encrypting, how I will decrypt again amd get the original text?

Most hashing algorithms (including MD5) are not intended to be "reversed". So, there's no reasonable way of retrieving the original text from an MD5 hash.

For a reversable mechanism, you might take a look as AES. The docs show an example of both encryption and decryption.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.