{"id":13705924,"url":"https://github.com/rstudio/rscrypt","last_synced_at":"2025-04-25T19:31:25.658Z","repository":{"id":12670705,"uuid":"15342685","full_name":"rstudio/rscrypt","owner":"rstudio","description":"scrypt cryptographic functions for R","archived":false,"fork":false,"pushed_at":"2022-04-19T14:01:46.000Z","size":219,"stargazers_count":33,"open_issues_count":4,"forks_count":14,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-08-03T22:16:17.670Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rstudio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.note","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-12-20T16:13:16.000Z","updated_at":"2024-03-29T03:33:38.000Z","dependencies_parsed_at":"2022-09-14T02:01:14.603Z","dependency_job_id":null,"html_url":"https://github.com/rstudio/rscrypt","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/rstudio%2Frscrypt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rstudio%2Frscrypt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rstudio%2Frscrypt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rstudio%2Frscrypt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rstudio","download_url":"https://codeload.github.com/rstudio/rscrypt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224014256,"owners_count":17241281,"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-08-02T22:00:49.775Z","updated_at":"2024-11-10T21:12:16.045Z","avatar_url":"https://github.com/rstudio.png","language":"C","funding_links":[],"categories":["Frameworks and Libs","C"],"sub_categories":["R"],"readme":"# rscrypt\n\n[![Build Status](https://travis-ci.org/rstudio/rscrypt.png?branch=master)](https://travis-ci.org/rstudio/rscrypt)\n\nrscrypt is an R package for a collection of scrypt cryptographic functions. Scrypt is a\npassword-based key derivation function created by Colin Percival. The algorithm was specifically\ndesigned to make it costly to perform large-scale custom hardware attacks by requiring large\namounts of memory.\n\n## Requirements\n\nThis package makes use of native code, you will need to have a R package development \nenvironment installed on your system:\n\n__Windows:__ RTools for building packages\n__Mac OSX:__ XCode Command Line Tools for building packages\n\n## Installation\n\nTo install directly from GitHub, run this:\n\n```\nif (!require(\"devtools\"))\n    install.packages(\"devtools\")\ndevtools::install_github(\"rstudio/rscrypt\")\n```\n\n## Usage\n\nHash a password:\n```\nhashed \u003c- scrypt::hashPassword(\"good password\")\n```\n\nVerify a hashed password:\n```\nscrypt::verifyPassword(hashed, \"bad bassword\")\n[1] FALSE\n\nscrypt::verifyPassword(hashed, \"good password\")\n[1] TRUE\n```\n\nKey derivation function\n```\npassword \u003c- charToRaw(\"my password\")\nsalt \u003c- sample(1:10, 32, replace=TRUE)\nscrypt::scrypt(password, salt, 65536, 8, 1)\n```\n\n## Password Hashing\n\nThe `hashPassword` and `verifyPassword` functions are designed be compatible with the\nnode.js scrypt package. The output from `hashPassword` is a base64 encoded string\ncontaining multiple pieces of information that are required to verify the hash later on.\nIncluded in this output are the n, r and p parameters for the scrypt function, as well as\na checksum and HMAC for verifying the integrity of the hash. Below is the format the hash.\n\n\n### Hash Format\n```\noffset\tlength\n0\t6\t\"scrypt\"\n6\t1\tscrypt data file version number (0)\n7\t1\tlog2(n) (big-endian must be between 1 and 63 inclusive)\n8\t4\tr (big-endian integer; must satisfy r * p \u003c 2^30)\n12\t4\tp (big-endian integer; must satisfy r * p \u003c 2^30)\n16\t32\tsalt\n48\t16\tfirst 16 bytes of SHA256(bytes 0 .. 47)\n64\t32\tHMAC-SHA256(bytes 0 .. 63)\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frstudio%2Frscrypt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frstudio%2Frscrypt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frstudio%2Frscrypt/lists"}