I have not thought about this yet, so I might be a stupid question.
How can I take a unique ASCII character string and convert it to a unique and reproducible (i.e., should be the same every time) 32-bit integer?
Any ideas?
, ASCII (.. 127), 7 35 . 32- 35 , ; , 7 ASCII. , , , - , , , . , CRC-32. -, MD5 SHA-1, 32 ; , , , .
(, -, , , - ), , , 32- .
- ([A-Z] [0-9]), 36.
ASCII, , 5 , 40 . ( ) , 35 ASCII 32 .
ascii 0-255, 8 ... 32 4 , 5. , , .
( 128-255) ascii ( ascii 0-127) 7 , 3 (7 * 5 = 35 32 .
- 5 N, N - ( ). .
, 32 5 , , 32 ^ (1/5) = 84 . , ASCII, ASCII ( > 127), 7 , - . 32 , , , , 95 .
11 . ASCII, , , .
84 , . 0..83,
intvalue = ((((char4*84+char1)*83+char2)*82+char3)*81+char0) char0 = intvalue % 84 char1 = (intvalue / 84) % 84; char2 = (intvalue / (84*84)) % 84; char3 = (intvalue / (84*84L*84)) % 84; char4 = (intvalue / (84*84L*84*84L) % 84;
, , - base-84 ; , base-64, .
Source: https://habr.com/ru/post/1764535/More articles:A problem with the JavaScript scope causes only one binding - javascriptjQuery - уникальный контроль над классом с использованием onChange - jqueryDI, constructor injection, modules, design patterns - dependency-injectionWhy does jQuery 1.4.2 compression have a syntax error? - javascriptHow to place popup in click event using silverlight 4? - silverlightMVVM Light Messenger runs multiple times - mvvm-lightPHP: how to reuse code (oop)? - oopPosting a problem with a base64 encoded file - postDoes Chrome Frame work in legacy IE ActiveX control? - google-chrome-frameMagento makes (OR) use of collections - phpAll Articles