Represent MD5 hash as an integer

前端 未结 8 1903
Happy的楠姐
Happy的楠姐 2021-02-05 09:42

In my user database table, I take the MD5 hash of the email address of a user as the id.

Example: email(example@example.org) = id(d41d8cd98f00b204e9800998ecf8427e)

8条回答
  •  花落未央
    2021-02-05 10:17

    Use the email address as the file name of a blank, temporary file in a shared folder, like /var/myprocess/example@example.org

    Then, call ftok on the file name. ftok will return a unique, integer ID.

    It won't be guaranteed to be unique though, but it will probably suffice for your API.

提交回复
热议问题