The Perl `/isos` endpoint handler uses the `crypt` function [0]. This is a 
built-in function that creates a digest string, like the crypt(3) function in 
the C library [1]. The endpoint is being re-written in Go.

The Go standard library does not provide this algorithm. The following ideas 
were considered (and rejected) for how to generate the digest in Go:
- Shell out to the “openssl passwd” executable.
- Use CGO to call the C library’s crypt function.

Instead, I’m proposing adding a vendored library, github.com/GehirnInc/crypt 
[2], that provides this same algorithm in pure Go. The library is BSD 2-Clause 
licensed. This will be included as part of the upcoming `/isos` re-write Pull 
Request, barring any objections.

[0] 
https://github.com/apache/trafficcontrol/blob/2cfa466479cfe777618f6489d7013251c8828607/traffic_ops/app/lib/API/Iso.pm#L194
[1] https://perldoc.perl.org/functions/crypt.html
[2] https://github.com/GehirnInc/crypt

Reply via email to