finki-main
main
|
Last change
on this file since 81bc7da was 81bc7da, checked in by Klimentina Efremova <klimentina08642@…>, 3 months ago |
|
Initial commit
|
-
Property mode
set to
100644
|
|
File size:
287 bytes
|
| Rev | Line | |
|---|
| [81bc7da] | 1 | 'use strict'
|
|---|
| 2 | var MurmurHash3 = require('imurmurhash')
|
|---|
| 3 |
|
|---|
| 4 | module.exports = function (uniq) {
|
|---|
| 5 | if (uniq) {
|
|---|
| 6 | var hash = new MurmurHash3(uniq)
|
|---|
| 7 | return ('00000000' + hash.result().toString(16)).substr(-8)
|
|---|
| 8 | } else {
|
|---|
| 9 | return (Math.random().toString(16) + '0000000').substr(2, 8)
|
|---|
| 10 | }
|
|---|
| 11 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.