🚀 Socket Launch Week 🚀 Day 1: Introducing .NET Support in Socket.Learn More
Socket
Sign inDemoInstall
Socket

github.com/euphoria-laxis/argon2utils

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/euphoria-laxis/argon2utils

v0.1.0
Source
Go
Version published
Created
Source

Argon2 utils

About

Utils to encrypt passwords using argon2

Usages

Hash password

    password := 'qwerty@123'
    // Create new encoder using default options
    encoder, _ := argon2.NewEncoder()
    hashedString, err = encoder.HashString(randomString)
    if err != nil {
        // handle error
    }

Compare password with hashed string

    // Create new decoder using default options
    decoder, _ := argon2.NewDecoder()
    match, err := decoder.CompareStringToHash(password, hashedString)
    if err != nil {
		// handle error
    }

Configure encoder or decoder options

Note that encoder and decoder inherited from the same base struct (argon2.Options). You can use the same argon2.OptFunc slice to configure both encoder and decoder.

    // Create new encoder using custom parameters
    encoder, options := argon2.NewEncoder(
        SetMemory(64 * 1024), // 64 bits
        SetParallelism(4),    // 4 concurrent actions
        SetKeyLength(32),     // key length
        SetSaltLength(32),    // salt length
        SetIterations(4),     // number of iterations
    )

Contributions

Euphoria Laxis GitHub

License

This project is under MIT License

FAQs

Package last updated on 11 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts