0

I have a number like this "3344550043374314" and I need an algorithm that can cypher this number and then add it to a VARCHAR column in a database.

  1. The encrypted number must not exceed the DB COLUMN size (19)
  2. Database column type cannot be altered

I've tested with "one time pad", "CaesarCipher", "DES", "secure HASH". None of them worked as a solution to this.

I need and encrypt/decrypt function that receives a key and string.

João Mendes
  • 1,719
  • 15
  • 32
Reversed
  • 51
  • 1
  • 10

1 Answers1

0

Since the column value you are storing is containing only numeric value so I don't think so you should Cipher the numerical value. But yes, if you are worried about the security you can design your own mechanism to subtract a particular number from the value and store them and while retrieving you may add that particular number back to get desired result.
If you are looking for more security then read Compress large Integers into smallest possible string which will allow you to compress-decompress and yes you can play a small trick to subtract and then compress-decompress for strengthening.

So this satisfies your conditions too,

  1. The encrypted number must not exceed the DB COLUMN size (19)
  2. Database column type cannot be altered

added with some Securtiy to prevent it to be cracked easily.

Community
  • 1
  • 1
Deepak Bhatia
  • 6,230
  • 2
  • 24
  • 58