Skip to content

Commit

Permalink
Merge branch 'release/v0.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewhartstonge committed Nov 5, 2022
2 parents 263f4e0 + a82f77d commit 4bb60d5
Show file tree
Hide file tree
Showing 16 changed files with 211 additions and 118 deletions.
9 changes: 9 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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/[email protected]

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.

17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,22 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
## [v0.3.0] - 2022-11-05
### Added
- .github: adds support for github actions, codeowners and dependabot.

### Changed
- deps: updates to `[email protected]` and `golang.org/x/[email protected]`.
- readme: update badges and remove references to travis ci.
- *: update project licensing.

### Fixed
- argon2: fixes grammar and comment line length.

### Removed
- dep: removes support for dep.
- travis: removes travis configuration.

## [v0.2.1] - 2022-02-22
GPG signed release.

Expand Down Expand Up @@ -83,6 +99,7 @@ GPG signed release.
- readme: Fix example link

[Unreleased]: https://github.com/matthewhartstonge/argon2/tree/master
[v0.3.0]: https://github.com/matthewhartstonge/argon2/tree/v0.3.0
[v0.2.1]: https://github.com/matthewhartstonge/argon2/tree/v0.2.1
[v0.2.0]: https://github.com/matthewhartstonge/argon2/tree/v0.2.0
[v0.1.5]: https://github.com/matthewhartstonge/argon2/tree/v0.1.5
Expand Down
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
Original file line number Diff line number Diff line change
@@ -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
16 changes: 16 additions & 0 deletions _example/example.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2022. Matthew Hartstonge <[email protected]>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package main

import (
Expand Down
27 changes: 23 additions & 4 deletions argon2.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2022. Matthew Hartstonge <[email protected]>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

// Package argon2 implements the key derivation function Argon2.
//
// Argon2 was selected as the winner of the Password Hashing Competition and
Expand Down Expand Up @@ -168,7 +184,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 +231,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 +257,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 +268,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
18 changes: 15 additions & 3 deletions argon2_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
// Copyright (c) 2016 Leonard Hecker
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
/*
* Copyright 2022. Matthew Hartstonge <[email protected]>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package argon2_test

Expand Down
24 changes: 19 additions & 5 deletions encoding.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
// Copyright (c) 2016 Leonard Hecker
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
/*
* Copyright 2022. Matthew Hartstonge <[email protected]>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package argon2

Expand Down Expand Up @@ -175,7 +187,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 +233,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
16 changes: 16 additions & 0 deletions encoding_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2022. Matthew Hartstonge <[email protected]>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package argon2

import (
Expand Down
Loading

0 comments on commit 4bb60d5

Please sign in to comment.