{"id":17671192,"url":"https://github.com/berkmann18/hashmyjs","last_synced_at":"2026-01-20T15:33:04.074Z","repository":{"id":29235783,"uuid":"115825259","full_name":"Berkmann18/hashmyjs","owner":"Berkmann18","description":"A simple NodeJS program that hashes JS files/codes and output it on the terminal or in files or via variables","archived":false,"fork":false,"pushed_at":"2022-11-01T22:08:35.000Z","size":19172,"stargazers_count":0,"open_issues_count":10,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-13T14:18:35.882Z","etag":null,"topics":["base64","csp","hashing","integrity","nodejs","sha-256"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Berkmann18.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"Berkmann18","patreon":"berkmann18"}},"created_at":"2017-12-30T21:28:31.000Z","updated_at":"2021-11-29T23:05:47.000Z","dependencies_parsed_at":"2022-08-30T12:31:00.224Z","dependency_job_id":null,"html_url":"https://github.com/Berkmann18/hashmyjs","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Berkmann18%2Fhashmyjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Berkmann18%2Fhashmyjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Berkmann18%2Fhashmyjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Berkmann18%2Fhashmyjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Berkmann18","download_url":"https://codeload.github.com/Berkmann18/hashmyjs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247604537,"owners_count":20965438,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["base64","csp","hashing","integrity","nodejs","sha-256"],"created_at":"2024-10-24T02:43:36.367Z","updated_at":"2026-01-20T15:33:03.795Z","avatar_url":"https://github.com/Berkmann18.png","language":"JavaScript","funding_links":["https://github.com/sponsors/Berkmann18","https://patreon.com/berkmann18"],"categories":[],"sub_categories":[],"readme":"# HashMyJS\n[![NPM](https://nodei.co/npm/hashmyjs.png)](https://nodei.co/npm/hashmyjs/)\n\u003c!-- [![NSP Status](https://nodesecurity.io/orgs/berkmann18/projects/ea369eec-8c46-4ad6-903c-739aa66d006a/badge)](https://nodesecurity.io/orgs/berkmann18/projects/ea369eec-8c46-4ad6-903c-739aa66d006a) --\u003e\n\n[![Build Status](https://travis-ci.org/Berkmann18/hashmyjs.svg?branch=master)](https://travis-ci.org/Berkmann18/hashmyjs)\n[![codecov.io Code Coverage](https://img.shields.io/codecov/c/github/Berkmann18/hashmyjs.svg?maxAge=2592000)](https://codecov.io/github/Berkmann18/hashmyjs?branch=master)\n[![tested with jest](https://img.shields.io/badge/tested_with-jest-99424f.svg)](https://github.com/facebook/jest)\n[![Known Vulnerabilities](https://snyk.io/test/github/Berkmann18/hashmyjs/badge.svg?targetFile=package.json)](https://snyk.io/test/github/Berkmann18/hashmyjs?targetFile=package.json)\n\n[![GitHub](https://img.shields.io/github/license/Berkmann18/hashmyjs.svg)](https://github.com/Berkmann18/hashmyjs/blob/master/LICENSE)\n[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/Berkmann18/hashmyjs/issues)\n[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)\n[![Dependabot Status](https://api.dependabot.com/badges/status?host=github\u0026identifier=115825259)](https://dependabot.com)\n\n[![GitHub top language](https://img.shields.io/github/languages/top/Berkmann18/hashmyjs.svg)](https://github.com/Berkmann18/hashmyjs)\n[![GitHub language count](https://img.shields.io/github/languages/count/Berkmann18/hashmyjs.svg)](https://github.com/Berkmann18/hashmyjs)\n[![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/Berkmann18/hashmyjs.svg)](https://github.com/Berkmann18/hashmyjs)\n\n[![Inline docs](http://inch-ci.org/github/Berkmann18/hashmyjs.svg?branch=master)](http://inch-ci.org/github/Berkmann18/hashmyjs)\n[![BCH compliance](https://bettercodehub.com/edge/badge/Berkmann18/hashmyjs?branch=master)](https://bettercodehub.com/results/Berkmann18/hashmyjs)\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/dcb7d393f7f24c0c9717e1254f6967c9)](https://app.codacy.com/app/maxieberkmann/hashmyjs?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=Berkmann18/hashmyjs\u0026utm_campaign=Badge_Grade_Dashboard)\n\n\nIt's a relatively simple NodeJS program that allows you to get the base64 encoded SHA-256 hash for a JS file or the code itself that you could later on use as the integrity of a script that you would integrate to a page so it won't be flagged by CSP or else.\n\n## Install\nTo install it you need to execute the following:\n```cli\nnpm i hashmyjs\n```\n\n_Note_: Don't forget to use `-g`, `--save`, `--save-dev` if appropriate.\n\n## Usage\n### In NodeJS\n```js\nconst hmj = require('hashmyjs');\n\n//Hashing from the STDIN (followed by a new line: `\\$`, `\\EOF`) or from file passed as arguments\nhmj.run();\n\n//Or if you want to hash code that is already present in your script:\nlet code = `...`;\nlet digest = hmj.hash(code);\n```\n\n### In the CLI\n```bash\nhashmyjs -- [options] [files] #If used via an npm script\n```\n**Help**:\n```cli\nUsage: hashmyjs [options] [files...]\n\n  A simple NodeJS JS file/code hasher.\n\n  Options:\n\n    -V, --version          output the version number\n    -f, --format [format]  Specify the format of the output (text (default), json, csv) (default: text)\n    -o, --output [path]    Output to a file instead of in the STDOUT (default: stdout)\n    -i, --interactive      Forces to read the input from the STDIN\n    -p, --prettify         Prettify the output\n    -h, --help             output usage information\n```\n\n## Nota bene\nIf you use wildcard `*` in the CLI to get files, NodeJS will have a hard time getting the file from the right URL so it will lead in errors.\n\n## Documentation\nSee [this](./DOCUMENTATION.md) for more information.\n\n## Contribution\nIf you discover bugs, errors or/and have suggestions/feedback please create an [issue](http://github.com/Berkmann18/hashmyjs/issues) or/and submit a [PR](http://github.com/Berkmann18/hashmyjs/pulls).\n\nIf you want to contribute, make sure you stick with the coding style that ESLint is enforcing (cf. configuration file).\nTo check if a file stick to the standards:\n```cli\neslint -c ./config/.eslintrc.js yourFile.js\n#Or `npm lint` if appropriate\n```\nTo fix formatting errors and such, run:\n```cli\n./fixjs.sh [your js files seperated by spaces]\n```\n\n## Contributors\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore --\u003e\n| [\u003cimg src=\"https://avatars0.githubusercontent.com/u/8260834?v=4\" width=\"100px;\" alt=\"Maximilian Berkmann\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eMaximilian Berkmann\u003c/b\u003e\u003c/sub\u003e](http://maxcubing.wordpress.com)\u003cbr /\u003e[🐛](https://github.com/Berkmann18/hashmyjs/issues?q=author%3ABerkmann18 \"Bug reports\") [💻](https://github.com/Berkmann18/hashmyjs/commits?author=Berkmann18 \"Code\") [📖](https://github.com/Berkmann18/hashmyjs/commits?author=Berkmann18 \"Documentation\") [🤔](#ideas-Berkmann18 \"Ideas, Planning, \u0026 Feedback\") [💬](#question-Berkmann18 \"Answering Questions\") [👀](#review-Berkmann18 \"Reviewed Pull Requests\") [🛡️](#security-Berkmann18 \"Security\") [⚠️](https://github.com/Berkmann18/hashmyjs/commits?author=Berkmann18 \"Tests\") | [\u003cimg src=\"https://avatars2.githubusercontent.com/u/36207117?v=4\" width=\"100px;\" alt=\"Dependabot\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eDependabot\u003c/b\u003e\u003c/sub\u003e](https://dependabot.com)\u003cbr /\u003e[🔧](#tool-dependabot-bot \"Tools\") | [\u003cimg src=\"https://avatars1.githubusercontent.com/u/32174276?v=4\" width=\"100px;\" alt=\"Semantic Release Bot\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eSemantic Release Bot\u003c/b\u003e\u003c/sub\u003e](http://semantic-release.org/)\u003cbr /\u003e[📖](https://github.com/Berkmann18/hashmyjs/commits?author=semantic-release-bot \"Documentation\") [📦](#platform-semantic-release-bot \"Packaging/porting to new platform\") | [\u003cimg src=\"https://avatars3.githubusercontent.com/u/23704769?v=4\" width=\"100px;\" alt=\"Codacy Badger\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eCodacy Badger\u003c/b\u003e\u003c/sub\u003e](https://www.codacy.com)\u003cbr /\u003e[🚇](#infra-codacy-badger \"Infrastructure (Hosting, Build-Tools, etc)\") |\n| :---: | :---: | :---: | :---: |\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fberkmann18%2Fhashmyjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fberkmann18%2Fhashmyjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fberkmann18%2Fhashmyjs/lists"}