Hash materials provides relevant initialized hash algo writers based on the expected signature type. - For signature v4 request if the connection is insecure compute only sha256. - For signature v4 request if the connection is secure compute only md5. - For anonymous request compute md5.
(isMd5Requested, isSha256Requested bool)
| 428 | // - For signature v4 request if the connection is secure compute only md5. |
| 429 | // - For anonymous request compute md5. |
| 430 | func (c *Client) hashMaterials(isMd5Requested, isSha256Requested bool) (hashAlgos map[string]md5simd.Hasher, hashSums map[string][]byte) { |
| 431 | hashSums = make(map[string][]byte) |
| 432 | hashAlgos = make(map[string]md5simd.Hasher) |
| 433 | if c.overrideSignerType.IsV4() { |
| 434 | if c.secure { |
| 435 | hashAlgos["md5"] = c.md5Hasher() |
| 436 | } else { |
| 437 | if isSha256Requested { |
| 438 | hashAlgos["sha256"] = c.sha256Hasher() |
| 439 | } |
| 440 | } |
| 441 | } else { |
| 442 | if c.overrideSignerType.IsAnonymous() { |
| 443 | hashAlgos["md5"] = c.md5Hasher() |
| 444 | } |
| 445 | } |
| 446 | if isMd5Requested { |
| 447 | hashAlgos["md5"] = c.md5Hasher() |
| 448 | } |
| 449 | return hashAlgos, hashSums |
| 450 | } |
| 451 | |
| 452 | const ( |
| 453 | unknown = -1 |
no test coverage detected