hash

package
v0.0.0-...-1e4470a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 11, 2023 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Copyright © 2022 Antonin Portelli <antonin.portelli@me.com>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HashToString

func HashToString(hash int64) string

Convert a path hash to an hexadecimal string

func Md548

func Md548(s string) int64

Return the hash of a string as int64 (SQLite does not support uint64). The hash is a 48 bit hash defined as follows

  1. compute the MD5 hash of the path
  2. take the 8 highest bytes of the MD5 hash
  3. set the 2 highest bytes to zero
  4. convert the result to int64 in big endian

func PathHash

func PathHash(path string) (int64, error)

func StepHash

func StepHash(parentHash int64, s string) int64

func StringToHash

func StringToHash(hash string) (int64, error)

Convert a path hash hexadecimal string to int64

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL