groovy-crypt

LDAP extensions for Groovy

License

License

Categories

Categories

Groovy Languages
GroupId

GroupId

org.xbib.groovy
ArtifactId

ArtifactId

groovy-crypt
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

groovy-crypt
LDAP extensions for Groovy
Project Organization

Project Organization

xbib

Download groovy-crypt

How to add to project

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

Dependencies

test (2)

Group / Artifact Type Version
org.codehaus.groovy : groovy-all jar 2.4.10
junit : junit jar 4.12

Project Modules

There are no modules declared in this project.

Groovy crypt library

groovy crypt badge License Apache%202.0 blue xbib

gate?key=org.xbib measure?key=org.xbib measure?key=org.xbib measure?key=org.xbib measure?key=org.xbib

This Groovy crypt implementation of the crypt(3) function provided in the GNU C library (glibc) was derived from crypt4j by Carl Harris https://github.com/soulwing/crypt4j

This implementation supports the MD5, SHA, SHA-256, and SHA-512 variants. Additionally, it supports legacy DES and HMAC.

It is useful for LDAP passwords or secure cookie handling.

Usage

void testHMAC() {
    String s = "Hello World"
    String secret = "secret"
    String code = CryptUtil.hmac(s, secret, "HmacSHA1")
    assertEquals("858da8837b87f04b052c0f6e954c3f7bbe081164", code)
}
void testSHA() {
    String plaintext = 'geheim'
    String code = CryptUtil.sha(plaintext)
    assertEquals('SHA algorithm',
            '{sha}kGByAB793z4R5tK1eC9Hd/4Dhzk=', code)
}
void testSSHA256() {
    String plaintext = 'geheim'
    byte[] salt = "467dd5b71e8d0f9e".decodeHex()
    String code = CryptUtil.ssha256(plaintext, salt)
    assertEquals('test SSHA-256 method',
            '{ssha256}9yT5rYItjXK+mY8sKNBcKsKSnlY6ysTg8wbDVmAguTFGfdW3Ho0Png==', code)
}
void testSSHA512() {
    String plaintext = 'geheim'
    byte[] salt = "3c68f1f47f41d82f".decodeHex()
    String code = CryptUtil.ssha512(plaintext, salt)
    assertEquals('test SSHA-512 method',
            '{ssha512}jeWuCXRjsvKh/vK548GP9ZCs4q9Sh1u700C8eONyV+EL/P810C8vlx9Eu4vRjHq/TDoGW8FE1l/P2KG3w9lHITxo8fR/Qdgv', code)
}
org.xbib.groovy
Organization for free exchange of bibliographic data

Versions

Version
1.0.0