Skip to content

Some questions for a port to Go #33

@nlepage

Description

@nlepage

Hello,

I discovered cuid2 (and cuid) today, and I gave a try at porting it to Go: https://github.com/nlepage/go-cuid2

It seems to be working fine, here are some ids generated with default length:

mhsx3pf2p8ocd2nlaioilwah
jt06wcr8l51t7wj9bxsdb0al
fvqdusrnkcohfi68gor7pooa
sdgqj4r3j0om523ykm0nch85
qw60k14c0kq14gnqjis8nh9f

I have some questions:

  • In createEntropy(), I'm calling a random prime number generator from the Go std library instead of picking in a predefined list of prime numbers
    • is ot OK?
    • isn't it too expensive? an alternative could be to generate a random prime numbers list once, then pick in this list when createEntropy() is called
  • In createFingerprint(), I don't have an equivalent of Object.keys(globalObj).toString()) to give to the hash function, is it a problem?

Thanks for your help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions