|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
284 bytes
|
| Line | |
|---|
| 1 | import crypto from 'crypto';
|
|---|
| 2 |
|
|---|
| 3 | function sha1(bytes) {
|
|---|
| 4 | if (Array.isArray(bytes)) {
|
|---|
| 5 | bytes = Buffer.from(bytes);
|
|---|
| 6 | } else if (typeof bytes === 'string') {
|
|---|
| 7 | bytes = Buffer.from(bytes, 'utf8');
|
|---|
| 8 | }
|
|---|
| 9 |
|
|---|
| 10 | return crypto.createHash('sha1').update(bytes).digest();
|
|---|
| 11 | }
|
|---|
| 12 |
|
|---|
| 13 | export default sha1; |
|---|
Note:
See
TracBrowser
for help on using the repository browser.