Jump to content
toufik

Encrypting string

Recommended Posts

what 's the best way to encrypt a string .?,
and to it password for example 

Share this post


Link to post
2 minutes ago, David Heffernan said:

It depends on what your usage is

i want to encrypt serial  number 

Share this post


Link to post

It doesn't much matter what the thing is that you encrypt. What matters is who encrypts it, and who has knowledge of the key or keys used to encrypt and decrypt. That's what I mean by usage. 

 

As for how you do it, convert the text to binary using a well defined encoding, e.g. UTF8, and encrypt that. Encryption algorithms work with binary data not text. 

  • Like 1

Share this post


Link to post
3 minutes ago, David Heffernan said:

It doesn't much matter what the thing is that you encrypt. What matters is who encrypts it, and who has knowledge of the key or keys used to encrypt and decrypt. That's what I mean by usage. 

 

As for how you do it, convert the text to binary using a well defined encoding, e.g. UTF8, and encrypt that. Encryption algorithms work with binary data not text. 

thanks for  replay i will try to get into it thank  s again 

Share this post


Link to post

There are a huge number of encryption methods. The best depends on the context you say nothing about.

As a start, see this article which is really a very basic encryption method.

For a more advanced solution, look for example at this source code on github.

  • Like 1

Share this post


Link to post
4 minutes ago, FPiette said:

As a start, see this article which is really a very basic encryption method.

Nothing there is useful. Hard to get past the basic sin of treating a string as if it were a byte array. 

  • Like 1

Share this post


Link to post
12 hours ago, toufik said:

what 's the best way to encrypt a string .?,
and to it password for example 

You mention passwords (and then serial numbers). Instead of encrypting, do you just want to hash it and store the hash, which can't be decrypted? This is often done with passwords (or a serial number that is entered for verification) where you don't ever need to decrypt the stored value, just generate a hash each time it's entered and compare the entered hash to the stored hash.

  • Thanks 1

Share this post


Link to post
11 hours ago, David Heffernan said:

Nothing there is useful. Hard to get past the basic sin of treating a string as if it were a byte array.

Not that what you say aren't true, but look at the screenshots. It's Delphi 7 so strings are basically byte arrays.

Share this post


Link to post
19 minutes ago, Anders Melander said:

Not that what you say aren't true, but look at the screenshots. It's Delphi 7 so strings are basically byte arrays.

Fair enough. Let's just switch to PHP then and be done with it. Bruh. 

  • Like 1
  • Haha 1

Share this post


Link to post

thank you all for help 
@FPiette you helped a lot thanks again .....

Edited by toufik

Share this post


Link to post
15 hours ago, toufik said:

great components ,,not free tho ^^ thanks for reply 

kbmMW Community Edition is free and contains what you need.

  • Thanks 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×