Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updates to golang.org/x/crypto@v0.1.0. #6

Merged
merged 6 commits into from Nov 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
@@ -0,0 +1,9 @@
# GitHub Code Owners
# More info about this file can be found in the GitHub documentation:
# https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners#codeowners-syntax

# Default reviewers for all files
* @matthewhartstonge

# Request a review from devops team members for github related changes.
.github/ @matthewhartstonge
11 changes: 11 additions & 0 deletions .github/dependabot.yml
@@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"

- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "daily"
59 changes: 59 additions & 0 deletions .github/workflows/go.yml
@@ -0,0 +1,59 @@
name: go

on:
pull_request:
branches:
- development
- main

permissions:
contents: read

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Setup Go
uses: actions/setup-go@v3
with:
go-version-file: 'go.mod'

- name: Download Go Modules
run: go mod download

- name: Run golangci-lint
uses: golangci/golangci-lint-action@v3.3.0

test:
name: Test Go@v${{ matrix.go-version }}
runs-on: ubuntu-latest
strategy:
matrix:
go-version:
- '1.11.4'
- '1.12'
- '1.13'
- '1.14'
- '1.15'
- '1.16'
- '1.17'
- '1.18'
- '1.19'
steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}

- name: Download Go Modules
run: go mod download

- name: Run Tests
run: go test ./...
20 changes: 0 additions & 20 deletions .travis.yml

This file was deleted.

28 changes: 0 additions & 28 deletions Gopkg.lock

This file was deleted.

36 changes: 0 additions & 36 deletions Gopkg.toml

This file was deleted.

11 changes: 3 additions & 8 deletions README.md
@@ -1,6 +1,6 @@
# 🔐 argon2

[![Build Status](https://travis-ci.org/matthewhartstonge/argon2.svg?branch=master)](https://travis-ci.org/matthewhartstonge/argon2)
[![Go Reference](https://pkg.go.dev/badge/github.com/matthewhartstonge/argon2.svg)](https://pkg.go.dev/github.com/matthewhartstonge/argon2) [![Go Report Card](https://goreportcard.com/badge/github.com/matthewhartstonge/argon2)](https://goreportcard.com/report/github.com/matthewhartstonge/argon2) [![go](https://github.com/matthewhartstonge/argon2/actions/workflows/go.yml/badge.svg)](https://github.com/matthewhartstonge/argon2/actions/workflows/go.yml)

argon2 provides a pure Go implementation for Argon2 password hashing.

Expand Down Expand Up @@ -63,17 +63,12 @@ go run _example/example.go

## Benchmarks

Benchmarks are run on each build. Follow the build badge link to check the
latest status on benchmarking results via TravisCI.

[![Build Status](https://travis-ci.org/matthewhartstonge/argon2.svg?branch=master)](https://travis-ci.org/matthewhartstonge/argon2)

The following manual benchmark was performed on a `i7-7700 @ 3.60GHz` with
`AData DDR4 2132MHz` memory.

Note:
- The native benchmarks have now been moved into a separate branch for
reference in order to keep go mod dependencies tidy.
- The native benchmarks are in a separate branch for reference in order to keep
go mod dependencies tidy.

```
goos: windows
Expand Down
11 changes: 7 additions & 4 deletions argon2.go
Expand Up @@ -168,7 +168,8 @@ func MemoryConstrainedDefaults() Config {

// Hash takes a password and optionally a salt and returns an Argon2 hash.
//
// If salt is nil a appropriate salt of Config.SaltLength bytes is generated for you.
// If salt is nil an appropriate salt of Config.SaltLength bytes is generated
// for you.
func (c *Config) Hash(pwd []byte, salt []byte) (Raw, error) {
if pwd == nil {
return Raw{}, ErrPwdTooShort
Expand Down Expand Up @@ -214,7 +215,8 @@ func (c *Config) HashEncoded(pwd []byte) (encoded []byte, err error) {
return
}

// Raw wraps a salt and hash pair including the Config with which it was generated.
// Raw wraps a salt and hash pair including the Config with which it was
// generated.
//
// A Raw struct is generated using Decode() or the Hash*() methods above.
//
Expand All @@ -239,7 +241,8 @@ func (raw *Raw) Verify(pwd []byte) (bool, error) {
return subtle.ConstantTimeCompare(r.Hash, raw.Hash) == 1, nil
}

// VerifyEncoded returns true if `pwd` matches the encoded hash `encoded` and otherwise false.
// VerifyEncoded returns true if `pwd` matches the encoded hash `encoded` and
// otherwise false.
func VerifyEncoded(pwd []byte, encoded []byte) (bool, error) {
r, err := Decode(encoded)
if err != nil {
Expand All @@ -249,7 +252,7 @@ func VerifyEncoded(pwd []byte, encoded []byte) (bool, error) {
}

// SecureZeroMemory is a helper method which sets all bytes in `b`
// (up to it's capacity) to `0x00`, erasing it's contents.
// (up to its capacity) to `0x00`, erasing its contents.
func SecureZeroMemory(b []byte) {
b = b[:cap(b):cap(b)]
for i := range b {
Expand Down
6 changes: 4 additions & 2 deletions encoding.go
Expand Up @@ -175,7 +175,8 @@ var (
encTypID = []byte("id$v=")
)

// Encode turns a Raw struct into the official stringified/encoded argon2 representation.
// Encode turns a Raw struct into the official stringified/encoded argon2
// representation.
//
// The resulting byte slice can safely be turned into a string.
func (raw *Raw) Encode() []byte {
Expand Down Expand Up @@ -220,7 +221,8 @@ func (raw *Raw) Encode() []byte {
return buf
}

// Decode takes a stringified/encoded argon2 hash and turns it back into a Raw struct.
// Decode takes a stringified/encoded argon2 hash and turns it back into a Raw
// struct.
//
// This decoder ignores "data" attributes as they are likely to be deprecated.
func Decode(encoded []byte) (Raw, error) {
Expand Down
6 changes: 3 additions & 3 deletions go.mod
@@ -1,7 +1,7 @@
module github.com/matthewhartstonge/argon2

go 1.17
go 1.18

require golang.org/x/crypto v0.0.0-20220214200702-86341886e292
require golang.org/x/crypto v0.1.0

require golang.org/x/sys v0.0.0-20220222160653-b146bcec3beb // indirect
require golang.org/x/sys v0.1.0 // indirect
15 changes: 4 additions & 11 deletions go.sum
@@ -1,11 +1,4 @@
golang.org/x/crypto v0.0.0-20220214200702-86341886e292 h1:f+lwQ+GtmgoY+A2YaQxlSOnDjXcQ7ZRLWOHbC6HtRqE=
golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220222160653-b146bcec3beb h1:Ilbx3DBAwVTR3lKQBhB5046dy7jic04dBpmG4fW/ru0=
golang.org/x/sys v0.0.0-20220222160653-b146bcec3beb/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/crypto v0.1.0 h1:MDRAIl0xIo9Io2xV565hzXHw3zVseKrJKodhohM5CjU=
golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw=
golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U=
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=