Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sterlp/hash
Common Lib to Hash passwords which is compatible to Java EE/ CDI (e.g. payara, wildfly) and Spring Boot.
https://github.com/sterlp/hash
bcrypt cli command-line-tool hash hash-passwords hashing jee jee7 password payara pbkdf pbkdf2 spring-boot
Last synced: about 2 months ago
JSON representation
Common Lib to Hash passwords which is compatible to Java EE/ CDI (e.g. payara, wildfly) and Spring Boot.
- Host: GitHub
- URL: https://github.com/sterlp/hash
- Owner: sterlp
- License: apache-2.0
- Created: 2020-10-20T10:37:44.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2024-07-18T08:16:16.000Z (6 months ago)
- Last Synced: 2024-07-18T10:26:29.950Z (6 months ago)
- Topics: bcrypt, cli, command-line-tool, hash, hash-passwords, hashing, jee, jee7, password, payara, pbkdf, pbkdf2, spring-boot
- Language: Java
- Homepage:
- Size: 61.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![Hash Lib CI](https://github.com/sterlp/hash/workflows/Hash%20Lib%20CI/badge.svg)
[![CodeQL](https://github.com/sterlp/hash/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/sterlp/hash/actions/workflows/codeql-analysis.yml)# Hash Lib Cli
Tool to create BCrypt and PBKDF2 hashes of passwords directly in the command line:- Download latest version of **hash-cli** here: https://github.com/sterlp/hash/releases
- [Maven Central](https://search.maven.org/search?q=org.sterl.hash)## Create a password hash
### BCrpyt
```
java -jar hash-cli.jar mypassword
> $2a$10$m4hjjVjjGD36bgHlblJaweMDrGelSO1lx4osfpNi/7DN9ZvTzMqA6
```### PBKDF2WithHmacSHA512
```
java -jar hash-cli.jar -a PBKDF2WithHmacSHA512 -p mypassword
> PBKDF2WithHmacSHA512:2048:ilIYz4CirlKeZfa59Tu9Dlruc69zaAxGyDb0OOcpppM=:HMv6yD8WUKSM2XY6jHIuzz9ShXX1wj120Njb0TptJ6hBBWAFnOdx0xR1hvz9ICtp91sdBxRaMyU8LsYZCIuP9g==
```## Verify a password hash
### BCrypt
```
java -jar hash-cli.jar -p foo -h "$2a$10$At1ZDrj3taopwLzeZ237KekybhWlF6quEd8bv9eAIWrTVzvtKyTEi"
> true
```### PBKDF2WithHmacSHA512
```
java -jar hash-cli.jar -a PBKDF2WithHmacSHA512 -p mypassword -h PBKDF2WithHmacSHA512:2048:ilIYz4CirlKeZfa59Tu9Dlruc69zaAxGyDb0OOcpppM=:HMv6yD8WUKSM2XY6jHIuzz9ShXX1wj120Njb0TptJ6hBBWAFnOdx0xR1hvz9ICtp91sdBxRaMyU8LsYZCIuP9g==
> true
```# hash-lib
Common lib which provides a common Hash algorithms for JEE and Spring Boot:
- BCrypt
- PBKDF2WithHmacSHA224
- PBKDF2WithHmacSHA256
- PBKDF2WithHmacSHA384
- PBKDF2WithHmacSHA512## jee-hash-lib
Support BCrypt and PBKDF2 password hash and verification. As so be compatible with existing JEE JDBC user stores and
Spring Boot user stores.## Usage
```java
import javax.annotation.security.DeclareRoles;
import javax.enterprise.context.ApplicationScoped;
import javax.security.enterprise.authentication.mechanism.http.BasicAuthenticationMechanismDefinition;
import javax.security.enterprise.identitystore.DatabaseIdentityStoreDefinition;
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;
import org.sterl.jee.hash.BCryptAndPbkdf2PasswordHash;@ApplicationScoped
@BasicAuthenticationMechanismDefinition(realmName = "jee-basic")
@DeclareRoles({ "admin", "user" }) // this authorities are allowed
@DatabaseIdentityStoreDefinition(
callerQuery = "select password from users where enabled = true AND username = ?",
groupsQuery = "select authority from authorities where username = ?",
dataSourceLookup = "jdbc/identity-store",
hashAlgorithm = BCryptAndPbkdf2PasswordHash.class,
hashAlgorithmParameters = {
"Algorithm=PBKDF2WithHmacSHA512"
}
)
@ApplicationPath("")
public class ApplicationConfiguration extends Application {
}
```
## Maven import JEE
```xmlorg.sterl.hash
jee-hash-lib
0.1.0```
# Base Lib
```xmlorg.sterl.hash
hash-lib
0.1.0```
- Release: https://oss.sonatype.org/content/repositories/releases/org/sterl/hash/
- Snapshot: https://oss.sonatype.org/content/repositories/snapshots/org/sterl/hash/## How to release
- `mvn versions:set -DnewVersion=x.x.x-SNAPSHOT`
- `mvn clean install -Prelease`
- `mvn deploy`