Code Monkey home page Code Monkey logo

Comments (4)

qinains avatar qinains commented on May 27, 2024

hex_md5("你好") is "7eca689f0d3389d9dea66ae112e5cfd7". But
(pandect.algo.md5/md5 "你好") is "b94ae3c6d892b29cf48d9bea819b27b9"

from pandect.

xsc avatar xsc commented on May 27, 2024

Your default charset does not seem to be UTF-8. For me, it's working:

(require '[pandect.algo [sha1 :refer [sha1]] [md5 :refer [md5]]])
(let [data "你好"]
  [(sha1 data) (md5 data)])
;; => ["440ee0853ad1e99f962b63e459ef992d7c211722"
;;     "7eca689f0d3389d9dea66ae112e5cfd7"]

The following should give you the right result:

(sha1 (.getBytes "你好" "UTF-8"))

But yes, pandect should by default convert to UTF-8 bytes.

from pandect.

xsc avatar xsc commented on May 27, 2024

Changes were released in

[pandect "0.5.0"]

from pandect.

qinains avatar qinains commented on May 27, 2024

👍

from pandect.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.