Skip to content

Commit

Permalink
Convert to maven sub-modules and add CLI module
Browse files Browse the repository at this point in the history
Rename the parent default module to "bcrypt-core" and add boilerplate
for CLI.

refs #5
  • Loading branch information
patrickfav committed Jul 16, 2018
1 parent 9af69d6 commit 273a9ae
Show file tree
Hide file tree
Showing 27 changed files with 230 additions and 91 deletions.
8 changes: 5 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@ deploy:
secure: "jTRC8q1o58sepRHphhUJEVnWPatWESdQuO8IYcqxQOSWsObD8Xr5KNrsLSgBAAGKCTEFdSb88/HrXQShZp1w4pdqTrmB4+eXgWxjtYNPzcaMkWMxsiJabLss91ahvvUVpNVp3AE2iHjUEOOqeXyx7ynhBVtvDn0Bf80O8ufqvq0PqQunQa5xlYp0UgTIEZ1BAoOtMTyWQrywvTRZj2ZLi0Aa5Lnqbrr2U2ZLqC3FLFOKveWJ8XxG10a2x2DmyRyW9h9EamXgoWVS3DqWOYdNDwEjgeih+0yNtJ1CWcDDC6PC77Nkit9/L5roCCnaTJbdhNdsVFBKP+1AUH81xMdSMl9SRKi16eVbjyEcu4laEzJlYz46eO8spbYJrmIDs59ij4C4dPQeb3LQPeioheEkFmUD/krZHH2klDnlN4T4nU2VPm0iYSkqezRHOkess+SDKxXvS8ZjmBcJLaI20QYLk+MFpWGw69JcgI90WHHFXBDLC+juz+16kmIEs6X96iaK0buysE0aSIy1/3l03mfnAl2fdMydrRhOkvWOpvOc67QCpkehEbhhC29TrbZAp954fu9akaKoHrdFU/I0Y4esM7CgzWUOc3oxfzInJ4Uva+Dun17gZxyuAXhvXqe7x9fPjpMnJGZUSe1E1GCja8BKpx4VFlz1SmBqC+FhDqTlmk8="
file_glob: true
file:
- "target/bcrypt-*.jar"
- "target/*.sha256"
- "target/checksum-sha256.txt"
- "target/bcrypt-core/bcrypt-*.jar"
- "target/bcrypt-core/*.sha256"
- "target/bcrypt-core/checksum-sha256.txt"
- "target/bcrypt-cli/bcrypt-*.jar"
- "target/bcrypt-cli/*.sha256"
skip_cleanup: true
on:
branch: master
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Releases

## v0.4.0

* change maven artifact to `bcrypt-core`
* add cli tool

## v0.3.0

* support 24byte hash out and make null terminator optional (BC style) #3
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Add dependency to your `pom.xml` ([check latest release](https://github.com/patr

<dependency>
<groupId>at.favre.lib</groupId>
<artifactId>bcrypt</artifactId>
<artifactId>bcrypt-core</artifactId>
<version>{latest-version}</version>
</dependency>

Expand Down
95 changes: 95 additions & 0 deletions bcrypt-cli/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<artifactId>bcrypt-parent</artifactId>
<groupId>at.favre.lib</groupId>
<version>0.4.0</version>
</parent>

<artifactId>bcrypt-cli</artifactId>
<packaging>jar</packaging>

<name>BCrypt CLI Tool</name>
<description>A companion CLI tool for the bcrypt library for java.</description>

<properties>
<maven.deploy.skip>true</maven.deploy.skip>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<minimizeJar>true</minimizeJar>
<createDependencyReducedPom>true</createDependencyReducedPom>
<dependencyReducedPomLocation>
${java.io.tmpdir}/dependency-reduced-pom.xml
</dependencyReducedPomLocation>
<relocations>
<relocation>
<pattern>com.acme.coyote</pattern>
<shadedPattern>hidden.coyote</shadedPattern>
</relocation>
</relocations>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>at.favre.lib.crypto.bcrypt.cli.Cli</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>net.nicoulaj.maven.plugins</groupId>
<artifactId>checksum-maven-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<goals>
<goal>artifacts</goal>
</goals>
</execution>
</executions>
<configuration>
<algorithms>
<algorithm>SHA-256</algorithm>
</algorithms>
<shasumSummary>true</shasumSummary>
<shasumSummaryFile>checksum-sha256.txt</shasumSummaryFile>
<attachChecksums>false</attachChecksums>
<quiet>false</quiet>
</configuration>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>at.favre.lib</groupId>
<artifactId>bcrypt-core</artifactId>
<version>0.4.0</version>
</dependency>

<!-- test -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package at.favre.lib.crypto.bcrypt.cli;

import at.favre.lib.crypto.bcrypt.BCrypt;

public class Cli {
public static void main(String[] args) {
System.out.println(BCrypt.withDefaults().hashToString(4, "asdasd".toCharArray()));
}
}
101 changes: 101 additions & 0 deletions bcrypt-core/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<artifactId>bcrypt-parent</artifactId>
<groupId>at.favre.lib</groupId>
<version>0.4.0</version>
</parent>

<artifactId>bcrypt-core</artifactId>
<packaging>jar</packaging>

<name>BCrypt Password Hashing Function</name>
<description>Bcrypt is a password hashing function designed by Niels Provos and David Mazières, based on the
Blowfish cipher. The core of this implementation is based on jBcrypt, but heavily refactored, modernized and
with a lot of updates and enhancements.
</description>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>net.nicoulaj.maven.plugins</groupId>
<artifactId>checksum-maven-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<goals>
<goal>artifacts</goal>
</goals>
</execution>
</executions>
<configuration>
<algorithms>
<algorithm>SHA-256</algorithm>
</algorithms>
<shasumSummary>true</shasumSummary>
<shasumSummaryFile>checksum-sha256.txt</shasumSummaryFile>
<attachChecksums>false</attachChecksums>
<quiet>false</quiet>
</configuration>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>at.favre.lib</groupId>
<artifactId>bytes</artifactId>
<version>0.4.6</version>
</dependency>

<!-- test -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mindrot</groupId>
<artifactId>jbcrypt</artifactId>
<version>0.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.60</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@
import org.junit.Test;

import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.concurrent.TimeUnit;

public class BcryptMicroBenchmark {
Expand Down
94 changes: 8 additions & 86 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,17 @@
<modelVersion>4.0.0</modelVersion>

<groupId>at.favre.lib</groupId>
<artifactId>bcrypt</artifactId>
<version>0.3.0</version>
<packaging>jar</packaging>
<artifactId>bcrypt-parent</artifactId>
<packaging>pom</packaging>
<version>0.4.0</version>

<name>BCrypt Password Hashing Function</name>
<description>Bcrypt is a password hashing function designed by Niels Provos and David Mazières, based on the
Blowfish cipher. The core of this implementation is based on jBcrypt, but heavily refactored, modernized and
with a lot of updates and enhancements.
</description>
<url>https://github.com/patrickfav/bcrypt</url>
<inceptionYear>2018</inceptionYear>

<prerequisites>
<maven>3.1.0</maven>
</prerequisites>
<modules>
<module>bcrypt-core</module>
<module>bcrypt-cli</module>
</modules>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down Expand Up @@ -78,32 +74,6 @@
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
Expand Down Expand Up @@ -140,64 +110,16 @@
</execution>
</executions>
<configuration>
<skip>false</skip> <!-- set this to true if fail because of missing credentials -->
<skip>true</skip> <!-- set this to true if fail because of missing credentials -->
<keystore>keystore.jks</keystore>
<alias>pfopensource</alias>
<storepass>${env.OPENSOURCE_PROJECTS_KS_PW}</storepass>
<keypass>${env.OPENSOURCE_PROJECTS_KEY_PW}</keypass>
</configuration>
</plugin>
<plugin>
<groupId>net.nicoulaj.maven.plugins</groupId>
<artifactId>checksum-maven-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<goals>
<goal>artifacts</goal>
</goals>
</execution>
</executions>
<configuration>
<algorithms>
<algorithm>SHA-256</algorithm>
</algorithms>
<shasumSummary>true</shasumSummary>
<shasumSummaryFile>checksum-sha256.txt</shasumSummaryFile>
<attachChecksums>false</attachChecksums>
<quiet>false</quiet>
</configuration>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>at.favre.lib</groupId>
<artifactId>bytes</artifactId>
<version>0.4.6</version>
</dependency>

<!-- test -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mindrot</groupId>
<artifactId>jbcrypt</artifactId>
<version>0.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.60</version>
<scope>test</scope>
</dependency>
</dependencies>
<developers>
<developer>
<id>patrickfav</id>
Expand Down

0 comments on commit 273a9ae

Please sign in to comment.