Closed amery closed 1 week ago
The changes introduce three new functions in the tls/x509utils/spki.go
file for computing SHA1, SHA224, and SHA256 hashes of a Subject Public Key, alongside a function for extracting the raw bytes of the public key. The file now includes four functions: SubjectPublicKeySHA1
, SubjectPublicKeySHA224
, SubjectPublicKeySHA256
, and SubjectPublicKeyBytes
, all designed to handle public key extraction and hashing, with appropriate error handling.
File | Change Summary |
---|---|
tls/x509utils/spki.go | Added functions: SubjectPublicKeySHA1 , SubjectPublicKeySHA224 , SubjectPublicKeySHA256 , and SubjectPublicKeyBytes for handling Subject Public Keys. |
x509utils
subpackage includes foundational functions for handling X.509 certificates, which are directly related to the new hashing functions for Subject Public Keys in the main PR.enhancement
, x/tls
In the land of keys so bright,
Public secrets take their flight.
SHA1, SHA224, they dance and play,
SHA256 joins the fun today!
With every hash, a tale unfolds,
In the world of tls, where magic beholds! πβ¨
Here's the code health analysis summary for commits 696ab33..a3c7757
. View details on DeepSource β.
Analyzer | Status | Summary | Link |
---|---|---|---|
Shell | β Success | View Check β | |
Go | β Failure | β 3 occurences introduced | View Check β |
π‘ If youβre a repository administrator, you can configure the quality gates from the settings.
This pre-allocation might slightly improve performance, especially if this function is called frequently.
please explain the difference
SubjectPublicKeySHA256()
added
47-68
: LGTM with a potential optimization.
@coderabbitai won't both give me a preallocated zeroed struct?
[!TIP] For best results, initiate chat on the files or code changes.
@amery, you're correct. Both approaches give you a preallocated zeroed struct, so there's no performance difference in this case. Thank you for pointing that out.
wow, deepsource really hates sha1
wow, deepsource really hates sha1
It is there, nobody is forced to use it, and anyway it is a hash, who cares, could be even md4
darvaza.org/x/tls@v0.2.2
tagged
to index and compare public keys
Summary by CodeRabbit