digest.scm 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2017, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
  3. ;;; Copyright © 2021 Ryan Prior <rprior@protonmail.com>
  4. ;;; Copyright © 2021 Ricardo Wurmus <rekado@elephly.net>
  5. ;;;
  6. ;;; This file is part of GNU Guix.
  7. ;;;
  8. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  9. ;;; under the terms of the GNU General Public License as published by
  10. ;;; the Free Software Foundation; either version 3 of the License, or (at
  11. ;;; your option) any later version.
  12. ;;;
  13. ;;; GNU Guix is distributed in the hope that it will be useful, but
  14. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  15. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. ;;; GNU General Public License for more details.
  17. ;;;
  18. ;;; You should have received a copy of the GNU General Public License
  19. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  20. (define-module (gnu packages digest)
  21. #:use-module ((guix licenses) #:prefix license:)
  22. #:use-module (guix packages)
  23. #:use-module (guix download)
  24. #:use-module (guix git-download)
  25. #:use-module (guix build-system gnu)
  26. #:use-module (guix build-system python)
  27. #:use-module (guix build-system trivial)
  28. #:use-module (guix utils)
  29. #:use-module (ice-9 match))
  30. (define-public wyhash
  31. (package
  32. (name "wyhash")
  33. (version "5")
  34. (source (origin
  35. (method git-fetch)
  36. (uri (git-reference
  37. (url "https://github.com/wangyi-fudan/wyhash")
  38. (commit (string-append "wyhash_v" version))))
  39. (file-name (git-file-name name version))
  40. (sha256
  41. (base32 "03ljs5iw9zrm3bydwggjvpwrcwmsd75h3dv1j4am4hw3h22cjdjc"))))
  42. (build-system trivial-build-system) ;; source-only package
  43. (arguments
  44. `(#:modules ((guix build utils))
  45. #:builder
  46. (begin
  47. (use-modules (guix build utils))
  48. (let* ((out (string-append (assoc-ref %outputs "out")))
  49. (include (string-append out "/include"))
  50. (doc (string-append out "/share/doc/" ,name "-" ,version))
  51. (source (assoc-ref %build-inputs "source")))
  52. (with-directory-excursion source
  53. (install-file "wyhash.h" include)
  54. (install-file "LICENSE" doc)
  55. (install-file "README.md" doc))
  56. #t))))
  57. (home-page "https://github.com/wangyi-fudan/wyhash")
  58. (synopsis "Embeddable hash function and random number generator")
  59. (description "This package provides a portable hash function and random
  60. number generator suitable for use in data structures. Provided by default in
  61. Zig, V, and Nim programming language standard libraries.")
  62. (license license:unlicense)))
  63. (define-public xxhash
  64. (package
  65. (name "xxhash")
  66. (version "0.8.0")
  67. (source
  68. (origin
  69. (method git-fetch)
  70. (uri (git-reference
  71. (url "https://github.com/Cyan4973/xxHash")
  72. (commit (string-append "v" version))))
  73. (file-name (git-file-name name version))
  74. (sha256
  75. (base32 "0hpbzdd6kfki5f61g103vp7pfczqkdj0js63avl0ss552jfb8h96"))))
  76. (build-system gnu-build-system)
  77. (arguments
  78. `(#:make-flags
  79. (list ,(string-append "CC=" (cc-for-target))
  80. ,(match (or (%current-target-system)
  81. (%current-system))
  82. ;; Detect vector instruction set at run time.
  83. ((or "i686-linux" "x86_64-linux") "DISPATCH=1")
  84. (_ "DISPATCH=0"))
  85. "XXH_FORCE_MEMORY_ACCESS=1" ; improved performance with GCC
  86. (string-append "prefix=" (assoc-ref %outputs "out")))
  87. #:phases
  88. (modify-phases %standard-phases
  89. (delete 'configure)))) ; no configure script
  90. (home-page "https://cyan4973.github.io/xxHash/")
  91. (synopsis "Extremely fast hash algorithm")
  92. (description
  93. "xxHash is an extremely fast non-cryptographic hash algorithm. It works
  94. at speeds close to RAM limits, and comes in both 32- and 64-bit flavours.
  95. The code is highly portable, and hashes of the same length are identical on all
  96. platforms (both big and little endian).")
  97. (license (list license:bsd-2 ; xxhash library (xxhash.[ch])
  98. license:gpl2+)))) ; xxhsum.c
  99. (define-public python-xxhash
  100. (package
  101. (name "python-xxhash")
  102. (version "2.0.2")
  103. (source
  104. (origin
  105. (method url-fetch)
  106. (uri (pypi-uri "xxhash" version))
  107. (sha256
  108. (base32
  109. "0jbvz19acznq00544gcsjg05fkvrmwbnwdfgrvwss3i1ys6avgmp"))))
  110. (build-system python-build-system)
  111. (home-page "https://github.com/ifduyue/python-xxhash")
  112. (synopsis "Python binding for xxHash")
  113. (description "This package provides Python bindings for the xxHash hash
  114. algorithm.")
  115. (license license:bsd-3)))