Faster MD5 alternative in JavaScript or jQuery

I often code in PHP and for caching I like to use md5 of a specific query (i.e. sql statement) as the name of my cache key. md5 gives me a beautiful line that is unique and therefore the reason I use it.

Now I am trying to implement some browser level caching using jQuery. It is intended for the address verification form. To reduce the number of ajax calls, I thought about turning the given address into a unique string that I could use as a key in the array.

Now I know that there are many JS MD5 solutions, but I was curious to find out if JS or even JQuery has anything native that I could use. Something like md5 or base64Encode.

+3
source share
1 answer

Faster alternative Im not sure (usually any increase in speed will be in milliseconds if you do not process the encoded keys through a specific function). As for the default encoding toolkit, as far as I know, apart from standard encoding sets, such as the ones you mention, this is about that.

What some people prefer to do is create their own sets of encodings (easier if you don't require them to be decoded later). If I don’t need encryption as such, but UID, then what I prefer is a small adaptation of the basic BASE 64 encoding, for example, adding a string with a random length number “x”, and then encoding b64, which ...

jQuery , , .

http://plugins.jquery.com/project/base64

, - !

+1

Source: https://habr.com/ru/post/1761281/


All Articles