crypt

package
v0.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 13, 2023 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Overview

Copied from https://github.com/amoghe/go-crypt/blob/b3e291286513a0c993f7c4dd7060d327d2d56143/crypt_r.go Original sources are under MIT license: The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Package crypt provides wrappers around functions available in crypt.h

It wraps around the GNU specific extension (crypt_r) when it is available (i.e. where GOOS=linux). This makes the go function reentrant (and thus callable from concurrent goroutines).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CryptSHA512

func CryptSHA512(phrase string) (string, error)

CryptSHA512 encrypts the given password with SHA512 and a random salt.

Note that this function is not deterministic.

func PasswordIsCrypted

func PasswordIsCrypted(s string) bool

PasswordIsCrypted returns true if the password appears to be an encrypted one, according to a very simple heuristic.

Any string starting with one of $2$, $6$ or $5$ is considered to be encrypted. Any other string is consdirede to be unencrypted.

This functionality is taken from pylorax.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL