├── .circleci └── config.yml ├── .gitignore ├── LICENSE ├── README.md ├── bcrypt ├── .gitignore ├── build.gradle.kts └── src │ ├── commonMain │ └── kotlin │ │ └── com │ │ └── toxicbakery │ │ └── bcrypt │ │ └── Bcrypt.kt │ ├── commonTest │ └── kotlin │ │ └── com │ │ └── toxicbakery │ │ └── bcrypt │ │ └── BcryptTest.kt │ ├── jsMain │ └── kotlin │ │ └── com │ │ └── toxicbakery │ │ └── bcrypt │ │ ├── Bcrypt.kt │ │ └── BcryptLib.kt │ └── jvmMain │ └── kotlin │ └── com │ └── toxicbakery │ └── bcrypt │ └── Bcrypt.kt ├── build.gradle.kts ├── config └── detekt.yml ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── maven.keystore.gpg └── settings.gradle /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | defaults: &defaults 2 | working_directory: ~/repo 3 | docker: 4 | - image: openjdk:8-jdk 5 | environment: 6 | TERM: dumb 7 | 8 | branches: 9 | ignore: 10 | - gh-pages 11 | 12 | version: 2 13 | jobs: 14 | build: 15 | <<: *defaults 16 | steps: 17 | - checkout 18 | - run: 19 | name: Execute Gradle 20 | command: | 21 | if [ -z "$CIRCLE_PR_REPONAME" ]; then 22 | echo "signing.keyId=${SIGNING_KEY}" >> "gradle.properties" 23 | echo "signing.password=${SIGNING_PASSWORD}" >> "gradle.properties" 24 | echo "signing.secretKeyRingFile=../maven.keystore" >> "gradle.properties" 25 | gpg --cipher-algo AES256 --yes --batch --passphrase=$ENC_FILE_KEY maven.keystore.gpg 26 | ./gradlew dokka build publish --no-daemon 27 | else 28 | ./gradlew build --no-daemon 29 | fi 30 | if [ -z "$CIRCLE_PR_REPONAME" ] && [ "master" = "$CIRCLE_BRANCH" ]; then 31 | git config --global user.email $GH_EMAIL 32 | git config --global user.name $GH_NAME 33 | cp -r .circleci bcrypt/build/dokkaHtml/.circleci 34 | cd bcrypt/build/dokkaHtml 35 | git init 36 | git checkout --orphan gh-pages 37 | git add -A >> /dev/null 38 | git commit -m "Automated deployment of ${CIRCLE_BRANCH} ${CIRCLE_SHA1}" --allow-empty 39 | git push -q https://${GH_PERSONAL_TOKEN}@github.com/ToxicBakery/${CIRCLE_PROJECT_REPONAME}.git gh-pages --force 40 | fi 41 | workflows: 42 | version: 2 43 | build: 44 | jobs: 45 | - build: 46 | context: Sonatype 47 | filters: 48 | tags: 49 | only: /.*/ 50 | branches: 51 | ignore: 52 | - gh-pages 53 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.gradle 2 | /.idea 3 | /build 4 | /local.properties 5 | /*.iml 6 | *.hprof 7 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright 2020 ToxicBakery 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Bcrypt MPP [![CircleCI](https://circleci.com/gh/ToxicBakery/bcrypt-mpp.svg?style=svg)](https://circleci.com/gh/ToxicBakery/bcrypt-mpp) [![Maven Central](https://img.shields.io/maven-central/v/com.ToxicBakery.library.bcrypt/bcrypt.svg)](https://oss.sonatype.org/content/repositories/releases/com/ToxicBakery/library/bcrypt/) [![Maven Central](https://img.shields.io/maven-metadata/v/https/oss.sonatype.org/content/repositories/snapshots/com/ToxicBakery/library/bcrypt/bcrypt/maven-metadata.xml.svg)](https://oss.sonatype.org/content/repositories/snapshots/com/ToxicBakery/library/bcrypt/) 2 | A multiplatform implementation of bcrypt for Node and the JVM 3 | 4 | ## Usage 5 | Exposes Bcrypt hashing and function in two methods. 6 | 7 | ```kotlin 8 | // Hash a given password using a given number of salt round. 9 | val hash = Bcrypt.hash(password, SALT_ROUNDS) 10 | 11 | // Verify a given password matches a previously hashed password 12 | if (Bcrypt.verify(password, hash)) { 13 | println("It's a match!") 14 | } 15 | ``` 16 | 17 | ### JVM 18 | The JVM implementation is build on `Bcrypt Java Library`. 19 | https://github.com/patrickfav/bcrypt 20 | 21 | ### NodeJS 22 | The JS implementation only supports NodeJS and is based on `bcrypt` library. 23 | https://github.com/kelektiv/node.bcrypt.js 24 | 25 | ## Install 26 | The output artifacts are maven artifacts for common code, Javascript, and Java 27 | 28 | Common: Use this if you are depending on Joise in a common module of an MPP project. 29 | ``` 30 | implementation("com.ToxicBakery.library.bcrypt:bcrypt:+") 31 | ``` 32 | 33 | Java 34 | ``` 35 | implementation("com.ToxicBakery.library.bcrypt:bcrypt:+") 36 | ``` 37 | 38 | JavaScript 39 | ``` 40 | implementation("com.ToxicBakery.library.bcrypt:bcrypt:+") 41 | ``` 42 | 43 | ## Build 44 | Requires OpenJDK 8+ 45 | 46 | ```bash 47 | ./gradlew build 48 | ``` 49 | -------------------------------------------------------------------------------- /bcrypt/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | /*.iml 3 | /gh-pages 4 | -------------------------------------------------------------------------------- /bcrypt/build.gradle.kts: -------------------------------------------------------------------------------- 1 | import org.jetbrains.dokka.gradle.DokkaTask 2 | 3 | plugins { 4 | id("org.jetbrains.kotlin.multiplatform") 5 | id("maven-publish") 6 | id("io.gitlab.arturbosch.detekt") 7 | id("org.jetbrains.dokka") 8 | id("signing") 9 | } 10 | 11 | kotlin { 12 | jvm {} 13 | js { 14 | nodejs {} 15 | } 16 | sourceSets { 17 | sourceSets["commonMain"].dependencies { 18 | implementation(kotlin("stdlib-common")) 19 | } 20 | sourceSets["commonTest"].dependencies { 21 | implementation(kotlin("test-common")) 22 | implementation(kotlin("test-annotations-common")) 23 | } 24 | sourceSets["jvmMain"].dependencies { 25 | implementation(kotlin("stdlib-jdk8")) 26 | api("at.favre.lib:bcrypt:0.9.0") 27 | } 28 | sourceSets["jvmTest"].dependencies { 29 | implementation(kotlin("test")) 30 | implementation(kotlin("test-junit")) 31 | } 32 | sourceSets["jsMain"].dependencies { 33 | implementation(kotlin("stdlib-js")) 34 | api(npm("bcrypt", "^3.0.6")) 35 | } 36 | sourceSets["jsTest"].dependencies { 37 | implementation(kotlin("test-js")) 38 | } 39 | } 40 | } 41 | 42 | detekt { 43 | failFast = true 44 | buildUponDefaultConfig = true 45 | config = files("$rootDir/config/detekt.yml") 46 | input = files( 47 | kotlin.sourceSets 48 | .flatMap { sourceSet -> sourceSet.kotlin.srcDirs } 49 | .map { file: File -> file.relativeTo(projectDir) } 50 | ) 51 | 52 | reports { 53 | html.enabled = true 54 | xml.enabled = false 55 | txt.enabled = false 56 | } 57 | } 58 | 59 | tasks { 60 | val dokka by getting(DokkaTask::class) { 61 | outputFormat = "html" 62 | outputDirectory = "$buildDir/dokkaHtml" 63 | multiplatform { 64 | val common by creating { 65 | includeNonPublic = false 66 | } 67 | val js by creating { 68 | includeNonPublic = false 69 | } 70 | val jvm by creating { 71 | includeNonPublic = false 72 | } 73 | } 74 | } 75 | } 76 | 77 | val dokkaJavadocJar by tasks.registering(Jar::class) { 78 | archiveClassifier.set("javadoc") 79 | dependsOn("dokka") 80 | from("$buildDir/dokkaHtml") 81 | } 82 | 83 | val POM_DESCRIPTION: String by project 84 | val POM_NAME: String by project 85 | val POM_URL: String by project 86 | val POM_SCM_URL: String by project 87 | val POM_SCM_CONNECTION: String by project 88 | val POM_SCM_DEV_CONNECTION: String by project 89 | val POM_LICENCE_NAME: String by project 90 | val POM_LICENCE_URL: String by project 91 | val POM_LICENCE_DIST: String by project 92 | val POM_DEVELOPER_ID: String by project 93 | val POM_DEVELOPER_NAME: String by project 94 | val POM_DEVELOPER_EMAIL: String by project 95 | val POM_DEVELOPER_ORGANIZATION: String by project 96 | val POM_DEVELOPER_ORGANIZATION_URL: String by project 97 | 98 | publishing { 99 | publications.withType().all { 100 | artifact(dokkaJavadocJar.get()) 101 | pom { 102 | description.set(POM_DESCRIPTION) 103 | name.set(POM_NAME) 104 | url.set(POM_URL) 105 | scm { 106 | url.set(POM_SCM_URL) 107 | connection.set(POM_SCM_CONNECTION) 108 | developerConnection.set(POM_SCM_DEV_CONNECTION) 109 | } 110 | licenses { 111 | license { 112 | name.set(POM_LICENCE_NAME) 113 | url.set(POM_LICENCE_URL) 114 | distribution.set(POM_LICENCE_DIST) 115 | } 116 | } 117 | developers { 118 | developer { 119 | id.set(POM_DEVELOPER_ID) 120 | name.set(POM_DEVELOPER_NAME) 121 | email.set(POM_DEVELOPER_EMAIL) 122 | organization.set(POM_DEVELOPER_ORGANIZATION) 123 | organizationUrl.set(POM_DEVELOPER_ORGANIZATION_URL) 124 | } 125 | } 126 | } 127 | } 128 | 129 | repositories { 130 | val releaseUrl = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/") 131 | val snapshotUrl = uri("https://oss.sonatype.org/content/repositories/snapshots") 132 | val sonatypeUsername = System.getenv("SONATYPE_USERNAME") ?: "" 133 | val sonatypePassword = System.getenv("SONATYPE_PASSWORD") ?: "" 134 | maven { 135 | url = if (version.toString().endsWith("SNAPSHOT")) snapshotUrl else releaseUrl 136 | credentials { 137 | username = if (sonatypeUsername.isBlank()) "" else sonatypeUsername 138 | password = if (sonatypePassword.isBlank()) "" else sonatypePassword 139 | } 140 | } 141 | } 142 | } 143 | 144 | if (!version.toString().endsWith("SNAPSHOT")) { 145 | signing { 146 | isRequired = false 147 | sign(publishing.publications) 148 | } 149 | } 150 | -------------------------------------------------------------------------------- /bcrypt/src/commonMain/kotlin/com/toxicbakery/bcrypt/Bcrypt.kt: -------------------------------------------------------------------------------- 1 | package com.toxicbakery.bcrypt 2 | 3 | /** 4 | * Platform dependent Bcrypt wrapper. 5 | */ 6 | expect object Bcrypt { 7 | 8 | /** 9 | * Given a secret and a number of rounds, hash the input using the platform Bcrypt implementation. 10 | * 11 | * @param input The secret to be hashed 12 | * @param saltRounds The computation iterations to be performed hashing the secret 13 | */ 14 | fun hash( 15 | input: String, 16 | saltRounds: Int 17 | ): ByteArray 18 | 19 | /** 20 | * Given a secret, determine if it matches a previously hashed secret. This method will perform hashing of the 21 | * input secret to determine if it is the same value as a previously hashed secret. 22 | * 23 | * @param input The secret to be validated 24 | * @param expected The previously hashed secret to check against 25 | */ 26 | fun verify( 27 | input: String, 28 | expected: ByteArray 29 | ): Boolean 30 | 31 | } 32 | -------------------------------------------------------------------------------- /bcrypt/src/commonTest/kotlin/com/toxicbakery/bcrypt/BcryptTest.kt: -------------------------------------------------------------------------------- 1 | package com.toxicbakery.bcrypt 2 | 3 | import kotlin.test.Test 4 | import kotlin.test.assertFalse 5 | import kotlin.test.assertTrue 6 | 7 | @ExperimentalStdlibApi 8 | class BcryptTest { 9 | 10 | @Test 11 | fun hash() { 12 | val hash = Bcrypt.hash(PASSWORD, SALT_ROUNDS) 13 | assertTrue(Bcrypt.verify(PASSWORD, hash)) 14 | assertFalse(Bcrypt.verify("$PASSWORD$PASSWORD", hash)) 15 | } 16 | 17 | companion object { 18 | private const val PASSWORD = "Hello bcrypt!" 19 | private const val SALT_ROUNDS = 6 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /bcrypt/src/jsMain/kotlin/com/toxicbakery/bcrypt/Bcrypt.kt: -------------------------------------------------------------------------------- 1 | package com.toxicbakery.bcrypt 2 | 3 | @ExperimentalStdlibApi 4 | actual object Bcrypt { 5 | 6 | actual fun hash(input: String, saltRounds: Int): ByteArray { 7 | val salt = genSaltSync(saltRounds) 8 | return hashSync(input, salt).encodeToByteArray() 9 | } 10 | 11 | actual fun verify(input: String, expected: ByteArray): Boolean = 12 | compareSync(input, expected.decodeToString()) 13 | 14 | } 15 | -------------------------------------------------------------------------------- /bcrypt/src/jsMain/kotlin/com/toxicbakery/bcrypt/BcryptLib.kt: -------------------------------------------------------------------------------- 1 | @file:JsModule("bcrypt") 2 | @file:JsNonModule 3 | package com.toxicbakery.bcrypt 4 | 5 | internal external fun genSaltSync(saltRounds: Int): String 6 | 7 | internal external fun hashSync(input: String, salt: String): String 8 | 9 | internal external fun compareSync(input: String, expected: String): Boolean 10 | -------------------------------------------------------------------------------- /bcrypt/src/jvmMain/kotlin/com/toxicbakery/bcrypt/Bcrypt.kt: -------------------------------------------------------------------------------- 1 | package com.toxicbakery.bcrypt 2 | 3 | import at.favre.lib.crypto.bcrypt.LongPasswordStrategies 4 | 5 | private typealias BcryptLib = at.favre.lib.crypto.bcrypt.BCrypt 6 | private typealias BcryptVersion = at.favre.lib.crypto.bcrypt.BCrypt.Version 7 | 8 | actual object Bcrypt { 9 | 10 | actual fun hash( 11 | input: String, 12 | saltRounds: Int 13 | ): ByteArray = 14 | BcryptLib.withDefaults() 15 | .hash(saltRounds, input.toByteArray()) 16 | 17 | actual fun verify( 18 | input: String, 19 | expected: ByteArray 20 | ): Boolean = 21 | BcryptLib.verifyer(null, LongPasswordStrategies.truncate(BcryptVersion.VERSION_2A)) 22 | .verify(input.toByteArray(), expected) 23 | .verified 24 | 25 | } 26 | -------------------------------------------------------------------------------- /build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("org.jetbrains.kotlin.multiplatform") version "1.3.71" apply false 3 | id("io.gitlab.arturbosch.detekt") version "1.7.1" apply false 4 | id("org.jetbrains.dokka") version "0.10.1" apply false 5 | } 6 | 7 | allprojects { 8 | val tagName = System.getenv("CIRCLE_TAG") 9 | val isTag = tagName != null && !tagName.isEmpty() 10 | val buildNumber = System.getenv("CIRCLE_BUILD_NUM") ?: "0" 11 | 12 | group = "com.ToxicBakery.library.bcrypt" 13 | version = "1.0.$buildNumber${if(isTag) "" else "-SNAPSHOT"}" 14 | println(version.toString()) 15 | 16 | repositories { 17 | mavenCentral() 18 | jcenter() 19 | maven { setUrl("http://dl.bintray.com/kotlin/kotlinx.html/") } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /config/detekt.yml: -------------------------------------------------------------------------------- 1 | build: 2 | maxIssues: 0 3 | excludeCorrectable: false 4 | weights: 5 | # complexity: 2 6 | # LongParameterList: 1 7 | # style: 1 8 | # comments: 1 9 | 10 | config: 11 | validation: true 12 | # when writing own rules with new properties, exclude the property path e.g.: 'my_rule_set,.*>.*>[my_property]' 13 | excludes: '' 14 | 15 | processors: 16 | active: true 17 | exclude: 18 | - 'DetektProgressListener' 19 | # - 'FunctionCountProcessor' 20 | # - 'PropertyCountProcessor' 21 | # - 'ClassCountProcessor' 22 | # - 'PackageCountProcessor' 23 | # - 'KtFileCountProcessor' 24 | 25 | console-reports: 26 | active: true 27 | exclude: 28 | - 'ProjectStatisticsReport' 29 | - 'ComplexityReport' 30 | - 'NotificationReport' 31 | # - 'FindingsReport' 32 | - 'FileBasedFindingsReport' 33 | 34 | comments: 35 | active: true 36 | excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt' 37 | AbsentOrWrongFileLicense: 38 | active: false 39 | licenseTemplateFile: 'license.template' 40 | CommentOverPrivateFunction: 41 | active: false 42 | CommentOverPrivateProperty: 43 | active: false 44 | EndOfSentenceFormat: 45 | active: false 46 | endOfSentenceFormat: '([.?!][ \t\n\r\f<])|([.?!:]$)' 47 | UndocumentedPublicClass: 48 | active: false 49 | searchInNestedClass: true 50 | searchInInnerClass: true 51 | searchInInnerObject: true 52 | searchInInnerInterface: true 53 | UndocumentedPublicFunction: 54 | active: false 55 | UndocumentedPublicProperty: 56 | active: false 57 | 58 | complexity: 59 | active: true 60 | ComplexCondition: 61 | active: true 62 | threshold: 4 63 | ComplexInterface: 64 | active: false 65 | threshold: 10 66 | includeStaticDeclarations: false 67 | includePrivateDeclarations: false 68 | ComplexMethod: 69 | active: true 70 | threshold: 15 71 | ignoreSingleWhenExpression: false 72 | ignoreSimpleWhenEntries: false 73 | ignoreNestingFunctions: false 74 | nestingFunctions: run,let,apply,with,also,use,forEach,isNotNull,ifNull 75 | LabeledExpression: 76 | active: false 77 | ignoredLabels: '' 78 | LargeClass: 79 | active: true 80 | threshold: 600 81 | LongMethod: 82 | active: true 83 | threshold: 60 84 | LongParameterList: 85 | active: true 86 | functionThreshold: 6 87 | constructorThreshold: 7 88 | ignoreDefaultParameters: false 89 | ignoreDataClasses: true 90 | MethodOverloading: 91 | active: false 92 | threshold: 6 93 | NestedBlockDepth: 94 | active: true 95 | threshold: 4 96 | StringLiteralDuplication: 97 | active: false 98 | excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt' 99 | threshold: 3 100 | ignoreAnnotation: true 101 | excludeStringsWithLessThan5Characters: true 102 | ignoreStringsRegex: '$^' 103 | TooManyFunctions: 104 | active: true 105 | excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt' 106 | thresholdInFiles: 11 107 | thresholdInClasses: 11 108 | thresholdInInterfaces: 11 109 | thresholdInObjects: 11 110 | thresholdInEnums: 11 111 | ignoreDeprecated: false 112 | ignorePrivate: false 113 | ignoreOverridden: false 114 | 115 | coroutines: 116 | active: true 117 | GlobalCoroutineUsage: 118 | active: false 119 | RedundantSuspendModifier: 120 | active: false 121 | 122 | empty-blocks: 123 | active: true 124 | EmptyCatchBlock: 125 | active: true 126 | allowedExceptionNameRegex: '^(_|(ignore|expected).*)' 127 | EmptyClassBlock: 128 | active: true 129 | EmptyDefaultConstructor: 130 | active: true 131 | EmptyDoWhileBlock: 132 | active: true 133 | EmptyElseBlock: 134 | active: true 135 | EmptyFinallyBlock: 136 | active: true 137 | EmptyForBlock: 138 | active: true 139 | EmptyFunctionBlock: 140 | active: true 141 | ignoreOverridden: false 142 | EmptyIfBlock: 143 | active: true 144 | EmptyInitBlock: 145 | active: true 146 | EmptyKtFile: 147 | active: true 148 | EmptySecondaryConstructor: 149 | active: true 150 | EmptyTryBlock: 151 | active: true 152 | EmptyWhenBlock: 153 | active: true 154 | EmptyWhileBlock: 155 | active: true 156 | 157 | exceptions: 158 | active: true 159 | ExceptionRaisedInUnexpectedLocation: 160 | active: false 161 | methodNames: 'toString,hashCode,equals,finalize' 162 | InstanceOfCheckForException: 163 | active: false 164 | excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt' 165 | NotImplementedDeclaration: 166 | active: false 167 | PrintStackTrace: 168 | active: false 169 | RethrowCaughtException: 170 | active: false 171 | ReturnFromFinally: 172 | active: false 173 | ignoreLabeled: false 174 | SwallowedException: 175 | active: false 176 | ignoredExceptionTypes: 'InterruptedException,NumberFormatException,ParseException,MalformedURLException' 177 | allowedExceptionNameRegex: '^(_|(ignore|expected).*)' 178 | ThrowingExceptionFromFinally: 179 | active: false 180 | ThrowingExceptionInMain: 181 | active: false 182 | ThrowingExceptionsWithoutMessageOrCause: 183 | active: false 184 | exceptions: 'IllegalArgumentException,IllegalStateException,IOException' 185 | ThrowingNewInstanceOfSameException: 186 | active: false 187 | TooGenericExceptionCaught: 188 | active: true 189 | excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt' 190 | exceptionNames: 191 | - ArrayIndexOutOfBoundsException 192 | - Error 193 | - Exception 194 | - IllegalMonitorStateException 195 | - NullPointerException 196 | - IndexOutOfBoundsException 197 | - RuntimeException 198 | - Throwable 199 | allowedExceptionNameRegex: '^(_|(ignore|expected).*)' 200 | TooGenericExceptionThrown: 201 | active: true 202 | exceptionNames: 203 | - Error 204 | - Exception 205 | - Throwable 206 | - RuntimeException 207 | 208 | formatting: 209 | active: true 210 | android: false 211 | autoCorrect: true 212 | AnnotationOnSeparateLine: 213 | active: false 214 | autoCorrect: true 215 | ChainWrapping: 216 | active: true 217 | autoCorrect: true 218 | CommentSpacing: 219 | active: true 220 | autoCorrect: true 221 | EnumEntryNameCase: 222 | active: false 223 | autoCorrect: true 224 | Filename: 225 | active: true 226 | FinalNewline: 227 | active: true 228 | autoCorrect: true 229 | insertFinalNewLine: true 230 | ImportOrdering: 231 | active: false 232 | autoCorrect: true 233 | Indentation: 234 | active: false 235 | autoCorrect: true 236 | indentSize: 4 237 | continuationIndentSize: 4 238 | MaximumLineLength: 239 | active: true 240 | maxLineLength: 120 241 | ModifierOrdering: 242 | active: true 243 | autoCorrect: true 244 | MultiLineIfElse: 245 | active: true 246 | autoCorrect: true 247 | NoBlankLineBeforeRbrace: 248 | active: true 249 | autoCorrect: true 250 | NoConsecutiveBlankLines: 251 | active: true 252 | autoCorrect: true 253 | NoEmptyClassBody: 254 | active: true 255 | autoCorrect: true 256 | NoEmptyFirstLineInMethodBlock: 257 | active: false 258 | autoCorrect: true 259 | NoLineBreakAfterElse: 260 | active: true 261 | autoCorrect: true 262 | NoLineBreakBeforeAssignment: 263 | active: true 264 | autoCorrect: true 265 | NoMultipleSpaces: 266 | active: true 267 | autoCorrect: true 268 | NoSemicolons: 269 | active: true 270 | autoCorrect: true 271 | NoTrailingSpaces: 272 | active: true 273 | autoCorrect: true 274 | NoUnitReturn: 275 | active: true 276 | autoCorrect: true 277 | NoUnusedImports: 278 | active: true 279 | autoCorrect: true 280 | NoWildcardImports: 281 | active: true 282 | PackageName: 283 | active: true 284 | autoCorrect: true 285 | ParameterListWrapping: 286 | active: true 287 | autoCorrect: true 288 | indentSize: 4 289 | SpacingAroundColon: 290 | active: true 291 | autoCorrect: true 292 | SpacingAroundComma: 293 | active: true 294 | autoCorrect: true 295 | SpacingAroundCurly: 296 | active: true 297 | autoCorrect: true 298 | SpacingAroundDot: 299 | active: true 300 | autoCorrect: true 301 | SpacingAroundKeyword: 302 | active: true 303 | autoCorrect: true 304 | SpacingAroundOperators: 305 | active: true 306 | autoCorrect: true 307 | SpacingAroundParens: 308 | active: true 309 | autoCorrect: true 310 | SpacingAroundRangeOperator: 311 | active: true 312 | autoCorrect: true 313 | StringTemplate: 314 | active: true 315 | autoCorrect: true 316 | 317 | naming: 318 | active: true 319 | ClassNaming: 320 | active: true 321 | excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt' 322 | classPattern: '[A-Z$][a-zA-Z0-9$]*' 323 | ConstructorParameterNaming: 324 | active: true 325 | excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt' 326 | parameterPattern: '[a-z][A-Za-z0-9]*' 327 | privateParameterPattern: '[a-z][A-Za-z0-9]*' 328 | excludeClassPattern: '$^' 329 | ignoreOverridden: true 330 | EnumNaming: 331 | active: true 332 | excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt' 333 | enumEntryPattern: '^[A-Z][_a-zA-Z0-9]*' 334 | ForbiddenClassName: 335 | active: false 336 | excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt' 337 | forbiddenName: '' 338 | FunctionMaxLength: 339 | active: false 340 | excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt' 341 | maximumFunctionNameLength: 30 342 | FunctionMinLength: 343 | active: false 344 | excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt' 345 | minimumFunctionNameLength: 3 346 | FunctionNaming: 347 | active: true 348 | excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt' 349 | functionPattern: '^([a-z$][a-zA-Z$0-9]*)|(`.*`)$' 350 | excludeClassPattern: '$^' 351 | ignoreOverridden: true 352 | FunctionParameterNaming: 353 | active: true 354 | excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt' 355 | parameterPattern: '[a-z][A-Za-z0-9]*' 356 | excludeClassPattern: '$^' 357 | ignoreOverridden: true 358 | InvalidPackageDeclaration: 359 | active: false 360 | rootPackage: '' 361 | MatchingDeclarationName: 362 | active: true 363 | mustBeFirst: true 364 | MemberNameEqualsClassName: 365 | active: true 366 | ignoreOverridden: true 367 | ObjectPropertyNaming: 368 | active: true 369 | excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt' 370 | constantPattern: '[A-Za-z][_A-Za-z0-9]*' 371 | propertyPattern: '[A-Za-z][_A-Za-z0-9]*' 372 | privatePropertyPattern: '(_)?[A-Za-z][_A-Za-z0-9]*' 373 | PackageNaming: 374 | active: true 375 | excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt' 376 | packagePattern: '^[a-z]+(\.[a-z][A-Za-z0-9]*)*$' 377 | TopLevelPropertyNaming: 378 | active: true 379 | excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt' 380 | constantPattern: '[A-Z][_A-Z0-9]*' 381 | propertyPattern: '[A-Za-z][_A-Za-z0-9]*' 382 | privatePropertyPattern: '_?[A-Za-z][_A-Za-z0-9]*' 383 | VariableMaxLength: 384 | active: false 385 | excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt' 386 | maximumVariableNameLength: 64 387 | VariableMinLength: 388 | active: false 389 | excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt' 390 | minimumVariableNameLength: 1 391 | VariableNaming: 392 | active: true 393 | excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt' 394 | variablePattern: '[a-z][A-Za-z0-9]*' 395 | privateVariablePattern: '(_)?[a-z][A-Za-z0-9]*' 396 | excludeClassPattern: '$^' 397 | ignoreOverridden: true 398 | 399 | performance: 400 | active: true 401 | ArrayPrimitive: 402 | active: true 403 | ForEachOnRange: 404 | active: true 405 | excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt' 406 | SpreadOperator: 407 | active: true 408 | excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt' 409 | UnnecessaryTemporaryInstantiation: 410 | active: true 411 | 412 | potential-bugs: 413 | active: true 414 | Deprecation: 415 | active: false 416 | DuplicateCaseInWhenExpression: 417 | active: true 418 | EqualsAlwaysReturnsTrueOrFalse: 419 | active: true 420 | EqualsWithHashCodeExist: 421 | active: true 422 | ExplicitGarbageCollectionCall: 423 | active: true 424 | HasPlatformType: 425 | active: false 426 | ImplicitDefaultLocale: 427 | active: false 428 | InvalidRange: 429 | active: true 430 | IteratorHasNextCallsNextMethod: 431 | active: true 432 | IteratorNotThrowingNoSuchElementException: 433 | active: true 434 | LateinitUsage: 435 | active: false 436 | excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt' 437 | excludeAnnotatedProperties: '' 438 | ignoreOnClassesPattern: '' 439 | MapGetWithNotNullAssertionOperator: 440 | active: false 441 | MissingWhenCase: 442 | active: true 443 | RedundantElseInWhen: 444 | active: true 445 | UnconditionalJumpStatementInLoop: 446 | active: false 447 | UnreachableCode: 448 | active: true 449 | UnsafeCallOnNullableType: 450 | active: true 451 | UnsafeCast: 452 | active: false 453 | UselessPostfixExpression: 454 | active: false 455 | WrongEqualsTypeParameter: 456 | active: true 457 | 458 | style: 459 | active: true 460 | CollapsibleIfStatements: 461 | active: false 462 | DataClassContainsFunctions: 463 | active: false 464 | conversionFunctionPrefix: 'to' 465 | DataClassShouldBeImmutable: 466 | active: false 467 | EqualsNullCall: 468 | active: true 469 | EqualsOnSignatureLine: 470 | active: false 471 | ExplicitCollectionElementAccessMethod: 472 | active: false 473 | ExplicitItLambdaParameter: 474 | active: false 475 | ExpressionBodySyntax: 476 | active: false 477 | includeLineWrapping: false 478 | ForbiddenComment: 479 | active: true 480 | values: 'TODO:,FIXME:,STOPSHIP:' 481 | allowedPatterns: '' 482 | ForbiddenImport: 483 | active: false 484 | imports: [] 485 | forbiddenPatterns: '' 486 | ForbiddenMethodCall: 487 | active: false 488 | methods: '' 489 | ForbiddenPublicDataClass: 490 | active: false 491 | ignorePackages: '*.internal,*.internal.*' 492 | ForbiddenVoid: 493 | active: false 494 | ignoreOverridden: false 495 | ignoreUsageInGenerics: false 496 | FunctionOnlyReturningConstant: 497 | active: true 498 | ignoreOverridableFunction: true 499 | excludedFunctions: 'describeContents' 500 | excludeAnnotatedFunction: 'dagger.Provides' 501 | LibraryCodeMustSpecifyReturnType: 502 | active: true 503 | LoopWithTooManyJumpStatements: 504 | active: true 505 | maxJumpCount: 1 506 | MagicNumber: 507 | active: true 508 | excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt' 509 | ignoreNumbers: '-1,0,1,2' 510 | ignoreHashCodeFunction: true 511 | ignorePropertyDeclaration: false 512 | ignoreLocalVariableDeclaration: false 513 | ignoreConstantDeclaration: true 514 | ignoreCompanionObjectPropertyDeclaration: true 515 | ignoreAnnotation: false 516 | ignoreNamedArgument: true 517 | ignoreEnums: false 518 | ignoreRanges: false 519 | MandatoryBracesIfStatements: 520 | active: false 521 | MaxLineLength: 522 | active: true 523 | maxLineLength: 120 524 | excludePackageStatements: true 525 | excludeImportStatements: true 526 | excludeCommentStatements: false 527 | MayBeConst: 528 | active: true 529 | ModifierOrder: 530 | active: true 531 | NestedClassesVisibility: 532 | active: false 533 | NewLineAtEndOfFile: 534 | active: true 535 | NoTabs: 536 | active: false 537 | OptionalAbstractKeyword: 538 | active: true 539 | OptionalUnit: 540 | active: false 541 | OptionalWhenBraces: 542 | active: false 543 | PreferToOverPairSyntax: 544 | active: false 545 | ProtectedMemberInFinalClass: 546 | active: true 547 | RedundantExplicitType: 548 | active: false 549 | RedundantVisibilityModifierRule: 550 | active: false 551 | ReturnCount: 552 | active: true 553 | max: 2 554 | excludedFunctions: 'equals' 555 | excludeLabeled: false 556 | excludeReturnFromLambda: true 557 | excludeGuardClauses: false 558 | SafeCast: 559 | active: true 560 | SerialVersionUIDInSerializableClass: 561 | active: false 562 | SpacingBetweenPackageAndImports: 563 | active: false 564 | ThrowsCount: 565 | active: true 566 | max: 2 567 | TrailingWhitespace: 568 | active: false 569 | UnderscoresInNumericLiterals: 570 | active: false 571 | acceptableDecimalLength: 5 572 | UnnecessaryAbstractClass: 573 | active: true 574 | excludeAnnotatedClasses: 'dagger.Module' 575 | UnnecessaryAnnotationUseSiteTarget: 576 | active: false 577 | UnnecessaryApply: 578 | active: false 579 | UnnecessaryInheritance: 580 | active: true 581 | UnnecessaryLet: 582 | active: false 583 | UnnecessaryParentheses: 584 | active: false 585 | UntilInsteadOfRangeTo: 586 | active: false 587 | UnusedImports: 588 | active: false 589 | UnusedPrivateClass: 590 | active: true 591 | UnusedPrivateMember: 592 | active: false 593 | allowedNames: '(_|ignored|expected|serialVersionUID)' 594 | UseArrayLiteralsInAnnotations: 595 | active: false 596 | UseCheckOrError: 597 | active: false 598 | UseDataClass: 599 | active: false 600 | excludeAnnotatedClasses: '' 601 | allowVars: false 602 | UseIfInsteadOfWhen: 603 | active: false 604 | UseRequire: 605 | active: false 606 | UselessCallOnNotNull: 607 | active: true 608 | UtilityClassWithPublicConstructor: 609 | active: true 610 | VarCouldBeVal: 611 | active: false 612 | WildcardImport: 613 | active: true 614 | excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt' 615 | excludeImports: 'java.util.*,kotlinx.android.synthetic.*' 616 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | kotlin.code.style=official 2 | 3 | POM_NAME=generator 4 | POM_PACKAGING=jar 5 | POM_DESCRIPTION=Bcrypt implementation for Kotlin Multiplatform 6 | POM_URL=https://github.com/ToxicBakery/bcrypt-mpp 7 | POM_SCM_URL=https://github.com/ToxicBakery/bcrypt-mpp.git 8 | POM_SCM_CONNECTION=scm:git@github.com:ToxicBakery/bcrypt-mpp.git 9 | POM_SCM_DEV_CONNECTION=scm:git@github.com:ToxicBakery/bcrypt-mpp.git 10 | POM_LICENCE_NAME=The Apache Software License, Version 2.0 11 | POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt 12 | POM_LICENCE_DIST=repo 13 | POM_DEVELOPER_ID=toxicbakery 14 | POM_DEVELOPER_NAME=Ian Thomas 15 | POM_DEVELOPER_EMAIL=toxicbakery@gmail.com 16 | POM_DEVELOPER_ORGANIZATION=Toxic Bakery 17 | POM_DEVELOPER_ORGANIZATION_URL=https://github.com/ToxicBakery 18 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ToxicBakery/bcrypt-mpp/ecf5a2c0ba5b0d426fecd985463645812be549b5/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # 4 | # Copyright 2015 the original author or authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | ## 21 | ## Gradle start up script for UN*X 22 | ## 23 | ############################################################################## 24 | 25 | # Attempt to set APP_HOME 26 | # Resolve links: $0 may be a link 27 | PRG="$0" 28 | # Need this for relative symlinks. 29 | while [ -h "$PRG" ] ; do 30 | ls=`ls -ld "$PRG"` 31 | link=`expr "$ls" : '.*-> \(.*\)$'` 32 | if expr "$link" : '/.*' > /dev/null; then 33 | PRG="$link" 34 | else 35 | PRG=`dirname "$PRG"`"/$link" 36 | fi 37 | done 38 | SAVED="`pwd`" 39 | cd "`dirname \"$PRG\"`/" >/dev/null 40 | APP_HOME="`pwd -P`" 41 | cd "$SAVED" >/dev/null 42 | 43 | APP_NAME="Gradle" 44 | APP_BASE_NAME=`basename "$0"` 45 | 46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 48 | 49 | # Use the maximum available, or set MAX_FD != -1 to use that value. 50 | MAX_FD="maximum" 51 | 52 | warn () { 53 | echo "$*" 54 | } 55 | 56 | die () { 57 | echo 58 | echo "$*" 59 | echo 60 | exit 1 61 | } 62 | 63 | # OS specific support (must be 'true' or 'false'). 64 | cygwin=false 65 | msys=false 66 | darwin=false 67 | nonstop=false 68 | case "`uname`" in 69 | CYGWIN* ) 70 | cygwin=true 71 | ;; 72 | Darwin* ) 73 | darwin=true 74 | ;; 75 | MINGW* ) 76 | msys=true 77 | ;; 78 | NONSTOP* ) 79 | nonstop=true 80 | ;; 81 | esac 82 | 83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 84 | 85 | # Determine the Java command to use to start the JVM. 86 | if [ -n "$JAVA_HOME" ] ; then 87 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 88 | # IBM's JDK on AIX uses strange locations for the executables 89 | JAVACMD="$JAVA_HOME/jre/sh/java" 90 | else 91 | JAVACMD="$JAVA_HOME/bin/java" 92 | fi 93 | if [ ! -x "$JAVACMD" ] ; then 94 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 95 | 96 | Please set the JAVA_HOME variable in your environment to match the 97 | location of your Java installation." 98 | fi 99 | else 100 | JAVACMD="java" 101 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 102 | 103 | Please set the JAVA_HOME variable in your environment to match the 104 | location of your Java installation." 105 | fi 106 | 107 | # Increase the maximum file descriptors if we can. 108 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 109 | MAX_FD_LIMIT=`ulimit -H -n` 110 | if [ $? -eq 0 ] ; then 111 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 112 | MAX_FD="$MAX_FD_LIMIT" 113 | fi 114 | ulimit -n $MAX_FD 115 | if [ $? -ne 0 ] ; then 116 | warn "Could not set maximum file descriptor limit: $MAX_FD" 117 | fi 118 | else 119 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 120 | fi 121 | fi 122 | 123 | # For Darwin, add options to specify how the application appears in the dock 124 | if $darwin; then 125 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 126 | fi 127 | 128 | # For Cygwin or MSYS, switch paths to Windows format before running java 129 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then 130 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 131 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 132 | JAVACMD=`cygpath --unix "$JAVACMD"` 133 | 134 | # We build the pattern for arguments to be converted via cygpath 135 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 136 | SEP="" 137 | for dir in $ROOTDIRSRAW ; do 138 | ROOTDIRS="$ROOTDIRS$SEP$dir" 139 | SEP="|" 140 | done 141 | OURCYGPATTERN="(^($ROOTDIRS))" 142 | # Add a user-defined pattern to the cygpath arguments 143 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 144 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 145 | fi 146 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 147 | i=0 148 | for arg in "$@" ; do 149 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 150 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 151 | 152 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 153 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 154 | else 155 | eval `echo args$i`="\"$arg\"" 156 | fi 157 | i=`expr $i + 1` 158 | done 159 | case $i in 160 | 0) set -- ;; 161 | 1) set -- "$args0" ;; 162 | 2) set -- "$args0" "$args1" ;; 163 | 3) set -- "$args0" "$args1" "$args2" ;; 164 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;; 165 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 166 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 167 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 168 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 169 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 170 | esac 171 | fi 172 | 173 | # Escape application args 174 | save () { 175 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 176 | echo " " 177 | } 178 | APP_ARGS=`save "$@"` 179 | 180 | # Collect all arguments for the java command, following the shell quoting and substitution rules 181 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 182 | 183 | exec "$JAVACMD" "$@" 184 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto init 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto init 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :init 68 | @rem Get command-line arguments, handling Windows variants 69 | 70 | if not "%OS%" == "Windows_NT" goto win9xME_args 71 | 72 | :win9xME_args 73 | @rem Slurp the command line arguments. 74 | set CMD_LINE_ARGS= 75 | set _SKIP=2 76 | 77 | :win9xME_args_slurp 78 | if "x%~1" == "x" goto execute 79 | 80 | set CMD_LINE_ARGS=%* 81 | 82 | :execute 83 | @rem Setup the command line 84 | 85 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 86 | 87 | @rem Execute Gradle 88 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 89 | 90 | :end 91 | @rem End local scope for the variables with windows NT shell 92 | if "%ERRORLEVEL%"=="0" goto mainEnd 93 | 94 | :fail 95 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 96 | rem the _cmd.exe /c_ return code! 97 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 98 | exit /b 1 99 | 100 | :mainEnd 101 | if "%OS%"=="Windows_NT" endlocal 102 | 103 | :omega 104 | -------------------------------------------------------------------------------- /maven.keystore.gpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ToxicBakery/bcrypt-mpp/ecf5a2c0ba5b0d426fecd985463645812be549b5/maven.keystore.gpg -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'bcrypt-mpp' 2 | enableFeaturePreview('GRADLE_METADATA') 3 | 4 | include ":bcrypt" --------------------------------------------------------------------------------