Generate HASH (Unique Random) from String in JavaScript -


I backend of your project parse (www.parse.com) I am using

I want to generate unique random ( promotion code ) by applying the current date and time in java script every time. Must be random readable characters / numbers.

I know random generation processes by searching Google but I'm not sure whether it is always unique or not. So to check this, every time I have to contact the backend, even if the existing random existing one matches the existing one. This is a long process as I need to do this process in the sign up process, so I want a better solution for this.

Can anyone help on this?

I can understand what your question is that you want a good hash function, which ensures that value is unique every time, so you do not assume you need to check for a long time that is unique or already exists.

means let me do some clear, hissing is not necessary 'Unique' but they are 'Unique enough' Best Hashing in JS For Aibreri, you

hashing function of different types are available, take a look at this:

  & lt; script src = "http: // crypto-js .googlecode.com / svn / tags / 3.1.2 / build / rollups / sha256.js "& gt; & lt; / script & gt; & LT; script & gt; var hash = Kriptojs. SH 256 (" message "); alert ( Taipf hash); // object alert (hash); // 2f77668a9dfbf8d5848b9eeb4a7145ca94c6ed9236e4a773f6dcafa5132b2f91 & lt; / script & gt;   

look at the value generated by that I mean hash function .. the value Possibility of getting duplicate Therefore, you can safely use one or use it to dig the library which you think is best for you.

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -