dumpDctHash writes the DCT hash to a writer
(w io.Writer)
| 210 | |
| 211 | // dumpDctHash writes the DCT hash to a writer |
| 212 | func (h *ImageHash) dumpDctHash(w io.Writer) error { |
| 213 | // Write length |
| 214 | if err := binary.Write(w, binary.LittleEndian, uint16(len(h.dctHash))); err != nil { |
| 215 | return fmt.Errorf("failed to write DCT hash length: %w", err) |
| 216 | } |
| 217 | |
| 218 | // Write array |
| 219 | if err := binary.Write(w, binary.LittleEndian, h.dctHash); err != nil { |
| 220 | return fmt.Errorf("failed to write DCT hash values: %w", err) |
| 221 | } |
| 222 | |
| 223 | return nil |
| 224 | } |
| 225 | |
| 226 | // loadDctHash reads a DCT hash from a reader |
| 227 | func (h *ImageHash) loadDctHash(r io.Reader) error { |