Skip to content

precision loss when GMP is not installed? #255

@ben-mckenzie

Description

@ben-mckenzie

Installations without GMP fall back to using PHP's native base_convert function which isn't designed to handle very large inputs like SHA3-512. The resulting ID values have an odd-looking pattern to them (note the amount of 0's, 4's and 8's for example):

bg48okgw0wwooo0g0488s4so
egcs480os8gkk84sgkgcgks8
fc00w044cckow4ock4s0w0sw
iw8ogk8woowk0cw8c8kgoscw
k40040s4kcsgsk0wg8scks8o
pwgo80o4c4kogk4gcs8oko8k
r8000cc8ggcsw0s8s44s440w
uc8gk8gog04wc044k4ck4s8c
zokgk80ww4o0sksws8s44osc
zwowwk4sc40c00ws44ww0gso

The issue is even noticeable in the example IDs shown in the readme 😄

When GMP is installed this issue goes away, but it should probably be made much clearer that GMP is needed for this library to work correctly.

Alternatively the dependency on GMP could be replaced with the library phlib/base_convert which seems to get the job done.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions