c# - What is a good way to generate a set of (relatively) short "invitation codes" -


this question has answer here:

during signup process app, users asked if have invitation code. way recognize "vip" users , instantly give them access, rather sticking them on waiting list.

i have (mostly) figured out, clueless how create sets of unique codes, , best way store them is. accepted practice this, , how should store values in sql (as string, or binary value, or what?)

thanks!


edit 1

  • any random set of numbers/letters fine. there doesn't need particular format.
  • each vip user have own code
  • there (probably/hopefully) few thousand codes handed out.

assuming have information user presumed unique, such email can create hashcode based on info.

userinfo.email.gethashcode();

now not horribly pretty. works.

another method used create dictionary of inspirational quotes. pull 1 dictionary @ random, put profile; register link give them prefills in quote field , hides if comes in via url , match. when submit data create account email & quote have match.

what need consider how people try hack vip account. if security concern need send encrypted hash. if not going protecting 'high value' target, consider user experience, , advancing brand. why opted quote.

don't use difficult user enter, if can't cleanly copy & paste invitation.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -