Android Question I need a small encryption

tsteward

Well-Known Member
Licensed User
Longtime User
I am looking for a way to do very simple encryption where the result is the same size or not much bigger than the original.
I like the idea of the result being hex that way it is simple for customers to relay.

So in my case I would encrypt a 4-10 digit code and give that to my customers. If and when they need that information they can tell me the code and I can decrypt it for them. This will mean that I don't need to keep this information, it is their responsibility.

Any suggestions?
I did look at Decrypter - De-/Encrypt String to base64 library but the result is too large.
Again doesn't need super security and I think hex result would be simplest to relay to customer and back again.
 

KMatle

Expert
Licensed User
Longtime User
Again doesn't need super security and I think hex result would be simplest to relay to customer and back again

So it's less an encryption and more like a serial code (like windows activation).

B4X:
Sub CreateHexSerial
    Dim HexString As String = "01234567890ABCDEF"
    Dim Serial As String
      
    For I=0 To 9 '= length of 10
        Serial=Serial & HexString.CharAt(Rnd(0, HexString.Length))
        Serial=Serial & HexString.CharAt(Rnd(0, HexString.Length))
    Next

    Log(Serial)
   
End Sub
 
Upvote 0

tsteward

Well-Known Member
Licensed User
Longtime User
I don't understand working with bytes etc.
I have tried B4XEncryption, the result is a little long and uses too many abnormal characters.

It doesn't have to be encryption as such it could be some form of encoding or maybe substitution.
It just needs to be easy to relay manually say over the phone.

Random serial is not what I need. I want to provide a key code for a vehicle or an immobiliser pin for my customers to keep but in a format that keeps them coming back to me or users of my app.

Typical key code W3234
Typical pin 1AE23E
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…