GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - joy-framework/cipher: Password hashing and encryption library for the janet programming language

BranchesTags
Open more actions menu

Latest commit

 

History

24 Commits
24 Commits

Folders and files

NameName
Last commit message
Last commit date
src
src
 
 
test
test
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
project.janet
project.janet
 
 

Repository files navigation

cipher

Hash passwords and encrypt strings with janet

Install

Add to your project.janet file

{:dependencies ["https://github.com/joy-framework/cipher"]}

Use

Libhydrogen requires a master key for all hashing/encryption functions, so the first step is to generate it

(import cipher)

(def key (cipher/password-key))

Now we can use that key when hashing a password

(def hashed-password (cipher/hash-password key "correct horse battery staple"))

This returns a garbled string that represents the password. Then to verify a plaintext password you call this

(cipher/verify-password key hashed-password "correct horse battery staple")

This returns either true or false.

Encryption

You can also encrypt strings!

(let [key (cipher/encryption-key)]
  (as-> "hello" ?
        (cipher/encrypt key ?)
        (cipher/decrypt key ?))) => "hello"

Generic hashing

(cipher/hash "hello") => "7fde0696c922ba4e1348dd7fa32f957531b861a93d78eef120a6c1a62fa3d2df"

Test

Run jpm test from the project folder.

About

Password hashing and encryption library for the janet programming language

Resources

Readme
MIT license
Activity
Custom properties

Stars

8 stars

Watchers

2 watching

Forks

1 fork
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.