{"id":15984793,"url":"https://github.com/phra/key-fingerprint","last_synced_at":"2025-03-18T00:31:37.226Z","repository":{"id":54267611,"uuid":"106296693","full_name":"phra/key-fingerprint","owner":"phra","description":"Node.js library to easy calculate MD*, SHA*, etc fingerprint of a public/private key in HEX encoding.","archived":false,"fork":false,"pushed_at":"2017-10-24T21:28:13.000Z","size":73,"stargazers_count":2,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-05-02T00:10:24.959Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/phra.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-10-09T14:49:11.000Z","updated_at":"2024-02-09T02:12:53.000Z","dependencies_parsed_at":"2022-08-13T10:30:59.967Z","dependency_job_id":null,"html_url":"https://github.com/phra/key-fingerprint","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/phra%2Fkey-fingerprint","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phra%2Fkey-fingerprint/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phra%2Fkey-fingerprint/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phra%2Fkey-fingerprint/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phra","download_url":"https://codeload.github.com/phra/key-fingerprint/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243893849,"owners_count":20364918,"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":[],"created_at":"2024-10-08T02:10:33.021Z","updated_at":"2025-03-18T00:31:36.906Z","avatar_url":"https://github.com/phra.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# key-fingerprint [![Build Status](https://travis-ci.org/phra/key-fingerprint.svg?branch=master)](https://travis-ci.org/phra/key-fingerprint) [![Coverage Status](https://coveralls.io/repos/github/phra/key-fingerprint/badge.svg?branch=master)](https://coveralls.io/github/phra/key-fingerprint?branch=master)\nNode.js library to easy calculate MD*, SHA*, etc fingerprint of a public/private key.\n\n## Installation\n\n`npm install key-fingerprint`\n\nOR\n\n`yarn add key-fingerprint`\n\n## Usage\n\n```typescript\nfingerprint(key: string, algorithm: string = 'sha512', colons: boolean = false)\n```\n\nOR\n\n```typescript\nexport enum SUPPORTED_ALGORITHM {\n  MD4 = 'md4',\n  MD5 = 'md5',\n  RMD160 = 'rmd160',\n  SHA1 = 'sha1',\n  SHA224 = 'sha224',\n  SHA256 = 'sha256',\n  SHA384 = 'sha384',\n  SHA512 = 'sha512',\n}\n\nexport enum SUPPORTED_ENCODING {\n  HEX = 'hex',\n  LATIN1 = 'latin1',\n  BASE64 = 'base64',\n}\n\ninterface IConfig {\n  algorithm: SUPPORTED_ALGORITHM,\n  colons: boolean,\n  encoding: SUPPORTED_ENCODING,\n}\n\nconst DEFAULT_CONFIGURATION: IConfig = {\n  algorithm: SUPPORTED_ALGORITHM.SHA256,\n  colons: false,\n  encoding: SUPPORTED_ENCODING.HEX,\n}\n\nfingerprint(key: string, configuration: Partial\u003cIConfig\u003e)\n```\n\n## Supported algorithms\n\n- MD4\n- MD5\n- RMD160\n- SHA1\n- SHA224\n- SHA256\n- SHA384\n- SHA512\n\n## Examples\n\n```typescript\nimport { fingerprint } from 'key-fingerprint'\n\nconst key = '-----BEGIN PUBLIC KEY-----\\n.........'\nconst sha256 = fingerprint(key, 'sha256') // =\u003e 'ab12ef12....\nconst sha256WithColons = fingerprint(key, 'sha256', true) // =\u003e 'ab:12:ef:12....\n```\n\n```typescript\nimport { fingerprint } from 'key-fingerprint'\n\nconst key = '-----BEGIN PUBLIC KEY-----\\n.........'\nconst config = { encoding: 'base64', algorithm: 'sha512' } // options fallback to default if missing\nconst sha512 = fingerprint(key, config) // =\u003e 'ZGlvIHBvcmN...\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphra%2Fkey-fingerprint","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphra%2Fkey-fingerprint","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphra%2Fkey-fingerprint/lists"}