Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to generate hash from timestamp?

Tags:

javascript

I must generate unique hash - maybe from timestamp. hash must have max 8 chars. How to do it?

For now I have only timestamp:

var t = new Date().getTime();
like image 979
Nips Avatar asked Sep 18 '15 10:09

Nips


People also ask

Can we use hashing for timestamp?

Common names for the output of a hashing function are a hash or a fingerprint. WordProof adds that hash to a blockchain transaction, after which it can't be altered or removed. This hash, stored in a blockchain, is what we call a timestamp.

How do you generate a hash number?

Click “Tools” in the top bar, then select the hashing algorithm you want to use. Next, select how you want to provide the input, you can choose “Generate”, “Generate from files”, and “Generate from selection into clipboard”.

What is a timestamp hash?

A timestamp defined hash algorithm is proposed in the present work for secure data dissemination among vehicles. The sender vehicle sends a deformed version of the original message along with the incomplete message digest to its neighbors.


1 Answers

That may look funny but the following code may work well for the next couple of centuries :)

(+new Date).toString(36);  // "iepii89m"

After that you can extend it with slicing method: (+new Date).toString(36).slice(-8).

like image 78
VisioN Avatar answered Sep 20 '22 08:09

VisioN