password-hashing

A library for password hashing by following current standards.

License

License

GroupId

GroupId

com.github.chrix75
ArtifactId

ArtifactId

password-hashing
Last Version

Last Version

0.2.0
Release Date

Release Date

Type

Type

jar
Description

Description

password-hashing
A library for password hashing by following current standards.
Project URL

Project URL

https://github.com/chrix75/password-hashing
Source Code Management

Source Code Management

https://github.com/chrix75/password-hashing

Download password-hashing

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.chrix75/password-hashing/ -->
<dependency>
    <groupId>com.github.chrix75</groupId>
    <artifactId>password-hashing</artifactId>
    <version>0.2.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.chrix75/password-hashing/
implementation 'com.github.chrix75:password-hashing:0.2.0'
// https://jarcasting.com/artifacts/com.github.chrix75/password-hashing/
implementation ("com.github.chrix75:password-hashing:0.2.0")
'com.github.chrix75:password-hashing:jar:0.2.0'
<dependency org="com.github.chrix75" name="password-hashing" rev="0.2.0">
  <artifact name="password-hashing" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.chrix75', module='password-hashing', version='0.2.0')
)
libraryDependencies += "com.github.chrix75" % "password-hashing" % "0.2.0"
[com.github.chrix75/password-hashing "0.2.0"]

Dependencies

test (1)

Group / Artifact Type Version
junit : junit jar 4.12

Project Modules

There are no modules declared in this project.

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());

Versions

Version
0.2.0
0.1.0