0

I saw a 'confirm_code' column in a db table, and property of the column is varchar(100), can you guys give me idea of a nice algo for a confirmation code ? Basically, it should consist of a random characters. The simplest things in my mind is just encrypting a string through md5 or sha1 but it won't fit because of the current column property.

codaddict
  • 445,704
  • 82
  • 492
  • 529
sasori
  • 5,249
  • 16
  • 86
  • 138

2 Answers2

2

An md5 hash should easily fit in a varchar(100)... in hex form an MD5 hash is typically 32 characters long.

Amber
  • 507,862
  • 82
  • 626
  • 550
2

You can generate unique ID's with uniqid().

TheMagician
  • 1,846
  • 7
  • 20
  • 26