🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

com.github.chrix75:password-hashing

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

com.github.chrix75:password-hashing

A library for password hashing by following current standards.

0.2.0
Source
Maven
Version published
Maintainers
1
Source

password-hashing

This Java library provides a way for password hashing.

Usage

The usage of this library rests on 2 classes. The first one is the Salt that returns a random salt.

The second one is Hash that uses the previously computed salt to process the password hashing.

Maven dependency

<dependency>
  <groupId>com.github.chrix75</groupId>
  <artifactId>password-hashing</artifactId>
  <version>0.1.0</version>
</dependency>

Examples

Getting a salt

Salt salt = new Salt(16);
String encodedSalt = salt.toString();

The toString method returns the salt value into a base 64 encoded string. It's useful for saving the salt value.

Hashing a password

Hash hash = new Hash("PASSWORD", salt);
String encodedPassword = hash.toString();

The toString method returns the hashed password into a base 64 encoded string.

Checking password correctness

PasswordChecker checker = new PasswordChecker(encodedPassword, "PASSWORD", encodedSalt);
assertTrue(checker.isCorrect());

FAQs

Package last updated on 01 Aug 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts