Skip to content
This repository has been archived by the owner on Apr 12, 2019. It is now read-only.

Simplify sha1 functions #111

Merged
merged 1 commit into from
Feb 10, 2018
Merged

Conversation

ethantkoenig
Copy link
Member

Some simplifications to prevent wheel re-invention:

  • Use hex.EncodeString(..) instead of manually hex encoding
    • This is likely to be faster, since we don't have to allocate a byte array containg 012..ef each call.
  • Use copy(..) instead of manually copying bytes
    • This is likely to be faster, since copy has architecture-specialized implementations
  • Use bytes.Equal(..) instead of manually comparing bytes
    • Again, this is likely to be faster, since bytes.Equal has architecture-specialized implementations

For the record, converting an array to a slice (arr[:]) does not copy the array.

@lunny
Copy link
Member

lunny commented Feb 10, 2018

LGTM

@lafriks lafriks merged commit 3413a6c into go-gitea:master Feb 10, 2018
@ethantkoenig ethantkoenig deleted the simplify/sha1 branch February 10, 2018 18:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants