{"id":20272332,"url":"https://github.com/steemit/libcrypto-js","last_synced_at":"2025-10-17T10:32:05.139Z","repository":{"id":72308900,"uuid":"110739583","full_name":"steemit/libcrypto-js","owner":"steemit","description":"Cryptographic utilities for Steem in Javascript. Zero dependencies.","archived":false,"fork":false,"pushed_at":"2018-12-24T10:57:28.000Z","size":876,"stargazers_count":5,"open_issues_count":5,"forks_count":17,"subscribers_count":19,"default_branch":"master","last_synced_at":"2025-04-11T04:41:59.575Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/steemit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-11-14T20:13:12.000Z","updated_at":"2023-11-13T15:29:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"e4f34347-8f50-45a5-aac7-64be5cc82d86","html_url":"https://github.com/steemit/libcrypto-js","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steemit%2Flibcrypto-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steemit%2Flibcrypto-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steemit%2Flibcrypto-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steemit%2Flibcrypto-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/steemit","download_url":"https://codeload.github.com/steemit/libcrypto-js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248345281,"owners_count":21088242,"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-11-14T12:43:00.513Z","updated_at":"2025-10-17T10:32:00.122Z","avatar_url":"https://github.com/steemit.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\nlibcrypto\n=========\n\nA small vendoring wrapper for [sjcl](http://bitwiseshiftleft.github.io/sjcl/) with support for\nhashes and encodings required by the Steem platform.\n\n## Usage\n\nIf you are using Webpack or Browserify, you must ensure that Node's built-in `crypto` package\nis excluded from your builds. \n\nOtherwise, just\n```sh\n$ yarn install steem-crypto\n```\n\n## API\n\n```\n\u003e crypto = require('@steemit/libcrypto');\n```\n\n### crypto.sha256(data)\n\nHashes the content of an `ArrayBuffer` using SHA-256.\n\n```\n\u003e shaHash = crypto.sha256(new Uint8Array().buffer)\nArrayBuffer { byteLength: 32 }\n\u003e crypto.hexify(shaHash)\n'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'\n```\n\n### crypto.ripemd160(data) \n\nHashes the content of an `ArrayBuffer` using RIPEMD-160.\n\n```\n\u003e ripemdHash = crypto.ripemd160(new Uint8Array().buffer)\nArrayBuffer { byteLength: 20 }\n\u003e crypto.hexify(ripemdHash)\n'9c1185a5c5e9fc54612808977ee8f548b2258d31'\n```\n\n### crypto.PrivateKey\n\nProvides operations over Steemit secp256k1-based ECC private keys.\n```\n\u003e secretKey = crypto.PrivateKey.from('5JCDRqLdyX4W7tscyzyxav8EaqABSVAWLvfi7rdqMKJneqqwQGt')\nPrivateKey { getPublicKey: [Function], sign: [Function] }\n\u003e secretKey.getPublicKey().toString()\n'STM5pZ15FDVAvNKW3saTJchWmSSmYtEvA6aKiXwDtCq2JRZV9KtR9'\n\u003e secretSig = secretKey.sign(new Uint8Array(32).buffer)\nArrayBuffer { byteLength: 65 }\n\u003e crypto.hexify(secretSig)\n'20387d5f9ae215a64065fde2a9d4f7be83d3480b7cc89f7c01488042da348845408909e9d4f1d66466c53f0007c771a73bf2883d8d5ab4735b5b4316091361442c'\n```\n\n### crypto.PublicKey\n\nProvides operations over Steemit secp256k1-based ECC public keys.\n```\n\u003e publicKey = crypto.PublicKey.from('STM5SKxjN1YdrFLgoPcp9KteUmNVdgE8DpTPC9sF6jbjVqP9d2Utq')\n... \n\u003e publicKey.verify(new Uint8Array(32).buffer, secretSig)\ntrue\n\u003e PublicKey.recover(someHash, someSig)\n...\n```\n\n### crypto.generateKeys()\n\nGenerates a new pair of keys in Steem WIF format using cryptographically secure\nrandom number generation.\n```\n\u003e crypto.generateKeys()\n{\n  private: \"5JCDRqLdyX4W7tscyzyxav8EaqABSVAWLvfi7rdqMKJneqqwQGt\",\n  public: \"STM5pZ15FDVAvNKW3saTJchWmSSmYtEvA6aKiXwDtCq2JRZV9KtR9\"\n}\n```\n\n### crypto.keysFromPassword(accountName, accountPassword)\n\nGiven a Steemit account name and password, regenerates the derived `owner`, `posting`,\n`active`, and `memo` keys.\n```\n\u003e crypto.keysFromPassword('username', 'password')\n{ owner:\n   { private: '5JCDRqLdyX4W7tscyzyxav8EaqABSVAWLvfi7rdqMKJneqqwQGt',\n     public: 'STM5pZ15FDVAvNKW3saTJchWmSSmYtEvA6aKiXwDtCq2JRZV9KtR9' },\n  memo:\n   { private: '5JSmQQJXH5ZrSW3KJSTUPFJy7SuLeDiY3bW6vB1McamxzJQFhwD',\n     public: 'STM5nwJgD9jmkAdTXuiz3jqrkw3om95gCapZo4e4Bcp3qzyiedwCn' },\n  posting:\n   { private: '5HsoxWiHRRyx6oSxKj32HDqDMzSGhs79zLZopDc7nMcjMbcPp5E',\n     public: 'STM6gZmazY23TEMkxmPpnmvbAgWFAzwtaSDbhSUdmpTXzoJJLPFH4' },\n  active:\n   { private: '5JamTPvZyQsHf8c2pbN92F1gUY3sJkpW3ZJFzdmfbAJPAXT5aw3',\n     public: 'STM5SKxjN1YdrFLgoPcp9KteUmNVdgE8DpTPC9sF6jbjVqP9d2Utq' } }\n```\n\n## Requirements\n\nsteem-crypto is written in Javascript as specified by \n[ECMA-262, version 5.1](https://www.ecma-international.org/ecma-262/5.1/).\nOther than its vendored copy of sjcl, it has no dependencies and never will.\n\nsteem-crypto explicitly supports the following environments without polyfills:\n- [Node.js](https://nodejs.com) versions 4 and up\n- Microsoft Edge (all versions)\n- Safari for macOS versions 7.1+\n- Safari for iOS versions 8+\n- Firefox, Chrome, and Opera versions 30+\n\nsteem-crypto explicitly does not support the following environments:\n- Opera Mini\n- Android Browser (i.e., the non-Chromium versions)\n- Microsoft Internet Explorer versions \u003c10\n\n## Contributing\n\nContributions must conform to the following rules:\n- They must pass formatting and linting and the existing automated test suite must pass.\n- They must add test coverage for new code.\n- They must not introduce any new dependencies.\n- They must support the environments listed above without the use of polyfills.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteemit%2Flibcrypto-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsteemit%2Flibcrypto-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteemit%2Flibcrypto-js/lists"}