{"id":16017498,"url":"https://github.com/madarche/mcf-js","last_synced_at":"2025-06-17T10:08:13.739Z","repository":{"id":25356735,"uuid":"28784469","full_name":"madarche/mcf-js","owner":"madarche","description":"Modular Crypt Format","archived":false,"fork":false,"pushed_at":"2022-12-07T02:52:38.000Z","size":190,"stargazers_count":5,"open_issues_count":5,"forks_count":18,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-11T11:44:59.646Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/madarche.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":"2015-01-04T20:00:47.000Z","updated_at":"2022-10-26T20:49:17.000Z","dependencies_parsed_at":"2023-01-14T02:36:13.511Z","dependency_job_id":null,"html_url":"https://github.com/madarche/mcf-js","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/madarche/mcf-js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madarche%2Fmcf-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madarche%2Fmcf-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madarche%2Fmcf-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madarche%2Fmcf-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/madarche","download_url":"https://codeload.github.com/madarche/mcf-js/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madarche%2Fmcf-js/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259983296,"owners_count":22941399,"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-08T16:06:23.440Z","updated_at":"2025-06-17T10:08:08.717Z","avatar_url":"https://github.com/madarche.png","language":"JavaScript","readme":"\nModular Crypt Format\n====================\n\n[![NPM version](http://img.shields.io/npm/v/mcf.svg)](https://www.npmjs.org/package/mcf)\n[![Dependency Status](https://david-dm.org/madarche/mcf-js.svg)](https://david-dm.org/madarche/mcf-js)\n[![devDependency Status](https://david-dm.org/madarche/mcf-js/dev-status.svg)](https://david-dm.org/madarche/mcf-js#info=devDependencies)\n[![Build Status](https://travis-ci.org/madarche/mcf-js.svg?branch=master)](https://travis-ci.org/madarche/mcf-js)\n[![Coverage Status](https://coveralls.io/repos/github/madarche/mcf-js/badge.svg?branch=master)](https://coveralls.io/github/madarche/mcf-js?branch=master)\n\nThis modules reads (deserialize) and writes (serialize) password fields in\ndatabases following the Modular Crypt Format (MCF).\n\nThe modular crypt format (MCF) is a standard for encoding password hash strings\nin order to defend a database against attacks (dictionary attacks, pre-computed\nrainbow table attacks, etc.).\n\nThe Modular Crypt Format is described in detail in\nhttps://passlib.readthedocs.io/en/stable/modular_crypt_format.html\n\n\nFormat\n------\n\nA password field in the Modular Crypt Format is of the following form:\n\n    $identifier$cost$salt$derived_key\n\n\nInstall\n-------\n\n```shell\nnpm install mcf\n```\n\n\nAPI\n---\n\n```javascript\ndeserialize(mcf_field)\n```\n\n```javascript\nserialize(identifier, cost, salt, derived_key)\n```\n\n\nUsage\n-----\n\nReading the format from the database:\n\n```javascript\nconst mcf = require('mcf')\n\nlet mcf_field = user.get('password')\ntry {\n    let obj = mcf.deserialize(mcf_field)\n    let identifier = obj.identifier\n    let cost = obj.cost\n    let salt = obj.salt\n    let derived_key = obj.derived_key\n} catch(err) {\n    if (err instanceof mcf.McfError) {\n        console.log(\"Format error in the database\", err)\n    } else {\n        console.log(\"Unexpected fail\")\n    }\n}\n```\n\nCreating the format to write in the database:\n\n```javascript\nconst mcf = require('mcf')\n\nlet mcf_field = mcf.serialize('pbkdf2', cost, salt, derived_key)\n```\n\nDevelopment\n-----------\n\nTo run the tests:\n```shell\nnpm test\n```\n\nTo compute test coverage:\n```shell\nnpm run test:coverage\n```\n\nContributions\n-------------\n\nPull Requests and contributions in general are welcome as long as they follow\nthe [Node aesthetic].\n\n[Node aesthetic]: http://substack.net/node_aesthetic\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmadarche%2Fmcf-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmadarche%2Fmcf-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmadarche%2Fmcf-js/lists"}