ulid-transform 1.3.0__cp311-cp311-win32.whl → 1.5.2__cp311-cp311-win32.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ulid_transform/__init__.py +1 -1
- ulid_transform/_py_ulid_impl.py +6 -3
- ulid_transform/_ulid_impl.cp311-win32.pyd +0 -0
- ulid_transform/ulid_struct.hh +185 -618
- ulid_transform/ulid_uint128.hh +211 -420
- ulid_transform/ulid_wrapper.cpp +67 -54
- ulid_transform/ulid_wrapper.h +1 -1
- {ulid_transform-1.3.0.dist-info → ulid_transform-1.5.2.dist-info}/METADATA +6 -5
- ulid_transform-1.5.2.dist-info/RECORD +14 -0
- {ulid_transform-1.3.0.dist-info → ulid_transform-1.5.2.dist-info}/WHEEL +1 -1
- ulid_transform/ulid.hh +0 -17
- ulid_transform-1.3.0.dist-info/RECORD +0 -15
- {ulid_transform-1.3.0.dist-info → ulid_transform-1.5.2.dist-info/licenses}/LICENSE +0 -0
ulid_transform/ulid_wrapper.cpp
CHANGED
|
@@ -1,75 +1,87 @@
|
|
|
1
1
|
#include "ulid_wrapper.h"
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
#ifdef __SIZEOF_INT128__ // http://stackoverflow.com/a/23981011
|
|
4
|
+
#include "ulid_uint128.hh"
|
|
5
|
+
#else
|
|
6
|
+
#include "ulid_struct.hh"
|
|
7
|
+
#endif
|
|
3
8
|
|
|
4
9
|
/**
|
|
5
|
-
* Generate a new text ULID and write it to the provided buffer.
|
|
6
|
-
* The buffer is NOT null-terminated.
|
|
7
|
-
*/
|
|
8
|
-
void _cpp_ulid(char dst[26])
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
* Generate a new text ULID and write it to the provided buffer.
|
|
11
|
+
* The buffer is NOT null-terminated.
|
|
12
|
+
*/
|
|
13
|
+
void _cpp_ulid(char dst[26])
|
|
14
|
+
{
|
|
15
|
+
ulid::ULID ulid;
|
|
16
|
+
ulid::EncodeTimeSystemClockNow(ulid);
|
|
17
|
+
ulid::EncodeEntropyMt19937Fast(ulid);
|
|
18
|
+
ulid::MarshalTo(ulid, dst);
|
|
13
19
|
}
|
|
14
20
|
|
|
15
21
|
/**
|
|
16
|
-
* Generate a new binary ULID and write it to the provided buffer.
|
|
17
|
-
*/
|
|
18
|
-
void _cpp_ulid_bytes(uint8_t dst[16])
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
* Generate a new binary ULID and write it to the provided buffer.
|
|
23
|
+
*/
|
|
24
|
+
void _cpp_ulid_bytes(uint8_t dst[16])
|
|
25
|
+
{
|
|
26
|
+
ulid::ULID ulid;
|
|
27
|
+
ulid::EncodeTimeSystemClockNow(ulid);
|
|
28
|
+
ulid::EncodeEntropyMt19937Fast(ulid);
|
|
29
|
+
ulid::MarshalBinaryTo(ulid, dst);
|
|
23
30
|
}
|
|
24
31
|
|
|
25
32
|
/**
|
|
26
|
-
* Generate a new text ULID at the provided epoch time and write it to the provided buffer.
|
|
27
|
-
* The buffer is NOT null-terminated.
|
|
28
|
-
*/
|
|
29
|
-
void _cpp_ulid_at_time(double epoch_time, char dst[26])
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
* Generate a new text ULID at the provided epoch time and write it to the provided buffer.
|
|
34
|
+
* The buffer is NOT null-terminated.
|
|
35
|
+
*/
|
|
36
|
+
void _cpp_ulid_at_time(double epoch_time, char dst[26])
|
|
37
|
+
{
|
|
38
|
+
ulid::ULID ulid;
|
|
39
|
+
ulid::EncodeTimestamp(static_cast<int64_t>(epoch_time * 1000), ulid);
|
|
40
|
+
ulid::EncodeEntropyMt19937Fast(ulid);
|
|
41
|
+
ulid::MarshalTo(ulid, dst);
|
|
34
42
|
}
|
|
35
43
|
|
|
36
44
|
/**
|
|
37
|
-
* Generate a new binary ULID at the provided epoch time and write it to the provided buffer.
|
|
38
|
-
*/
|
|
39
|
-
void _cpp_ulid_at_time_bytes(double epoch_time, uint8_t dst[16])
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
45
|
+
* Generate a new binary ULID at the provided epoch time and write it to the provided buffer.
|
|
46
|
+
*/
|
|
47
|
+
void _cpp_ulid_at_time_bytes(double epoch_time, uint8_t dst[16])
|
|
48
|
+
{
|
|
49
|
+
ulid::ULID ulid;
|
|
50
|
+
ulid::EncodeTimestamp(static_cast<int64_t>(epoch_time * 1000), ulid);
|
|
51
|
+
ulid::EncodeEntropyMt19937Fast(ulid);
|
|
52
|
+
ulid::MarshalBinaryTo(ulid, dst);
|
|
44
53
|
}
|
|
45
54
|
|
|
46
55
|
/**
|
|
47
|
-
* Convert a text ULID to a binary ULID.
|
|
48
|
-
* The buffer passed in must contain at least 26 bytes.
|
|
49
|
-
* Invalid data will result in undefined behavior.
|
|
50
|
-
*/
|
|
51
|
-
void _cpp_ulid_to_bytes(const char
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
56
|
+
* Convert a text ULID to a binary ULID.
|
|
57
|
+
* The buffer passed in must contain at least 26 bytes.
|
|
58
|
+
* Invalid data will result in undefined behavior.
|
|
59
|
+
*/
|
|
60
|
+
void _cpp_ulid_to_bytes(const char* ulid_string, uint8_t dst[16])
|
|
61
|
+
{
|
|
62
|
+
ulid::ULID ulid;
|
|
63
|
+
ulid::UnmarshalFrom(ulid_string, ulid);
|
|
64
|
+
ulid::MarshalBinaryTo(ulid, dst);
|
|
55
65
|
}
|
|
56
66
|
|
|
57
67
|
/**
|
|
58
|
-
* Convert a binary ULID to a text ULID.
|
|
59
|
-
* The buffer passed in must contain at least 16 bytes.
|
|
60
|
-
* The output buffer will NOT be null-terminated.
|
|
61
|
-
*/
|
|
62
|
-
void _cpp_bytes_to_ulid(const uint8_t b[16], char dst[26])
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
68
|
+
* Convert a binary ULID to a text ULID.
|
|
69
|
+
* The buffer passed in must contain at least 16 bytes.
|
|
70
|
+
* The output buffer will NOT be null-terminated.
|
|
71
|
+
*/
|
|
72
|
+
void _cpp_bytes_to_ulid(const uint8_t b[16], char dst[26])
|
|
73
|
+
{
|
|
74
|
+
ulid::ULID ulid;
|
|
75
|
+
ulid::UnmarshalBinaryFrom(b, ulid);
|
|
76
|
+
ulid::MarshalTo(ulid, dst);
|
|
66
77
|
}
|
|
67
78
|
|
|
68
79
|
/**
|
|
69
|
-
* Convert a buffer of exactly 16 bytes to 32 hex characters.
|
|
70
|
-
* The output buffer will NOT be null-terminated.
|
|
71
|
-
*/
|
|
72
|
-
void _cpp_hexlify_16(const uint8_t b[16], char dst[32])
|
|
80
|
+
* Convert a buffer of exactly 16 bytes to 32 hex characters.
|
|
81
|
+
* The output buffer will NOT be null-terminated.
|
|
82
|
+
*/
|
|
83
|
+
void _cpp_hexlify_16(const uint8_t b[16], char dst[32])
|
|
84
|
+
{
|
|
73
85
|
static const char hexdigits[17] = "0123456789abcdef";
|
|
74
86
|
int in_index, out_index;
|
|
75
87
|
for (in_index = out_index = 0; in_index < 16; in_index++) {
|
|
@@ -80,9 +92,10 @@ void _cpp_hexlify_16(const uint8_t b[16], char dst[32]) {
|
|
|
80
92
|
}
|
|
81
93
|
|
|
82
94
|
/**
|
|
83
|
-
* Interpret the first 6 bytes of a binary ULID as a timestamp.
|
|
84
|
-
*/
|
|
85
|
-
uint64_t _cpp_bytes_to_timestamp(const uint8_t b[16])
|
|
95
|
+
* Interpret the first 6 bytes of a binary ULID as a timestamp.
|
|
96
|
+
*/
|
|
97
|
+
uint64_t _cpp_bytes_to_timestamp(const uint8_t b[16])
|
|
98
|
+
{
|
|
86
99
|
uint64_t timestamp = 0;
|
|
87
100
|
timestamp |= static_cast<uint64_t>(b[0]) << 40;
|
|
88
101
|
timestamp |= static_cast<uint64_t>(b[1]) << 32;
|
ulid_transform/ulid_wrapper.h
CHANGED
|
@@ -6,7 +6,7 @@ void _cpp_ulid(char dst[26]);
|
|
|
6
6
|
void _cpp_ulid_bytes(uint8_t dst[16]);
|
|
7
7
|
void _cpp_ulid_at_time(double epoch_time, char dst[26]);
|
|
8
8
|
void _cpp_ulid_at_time_bytes(double epoch_time, uint8_t dst[16]);
|
|
9
|
-
void _cpp_ulid_to_bytes(const char
|
|
9
|
+
void _cpp_ulid_to_bytes(const char* ulid_string, uint8_t dst[16]);
|
|
10
10
|
void _cpp_bytes_to_ulid(const uint8_t b[16], char dst[26]);
|
|
11
11
|
void _cpp_hexlify_16(const uint8_t b[16], char dst[32]);
|
|
12
12
|
uint64_t _cpp_bytes_to_timestamp(const uint8_t b[16]);
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: ulid-transform
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.5.2
|
|
4
4
|
Summary: Create and transform ULIDs
|
|
5
|
-
License: MIT
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
License-File: LICENSE
|
|
6
7
|
Author: J. Nick Koston
|
|
7
8
|
Author-email: nick@koston.org
|
|
8
|
-
Requires-Python: >=3.11
|
|
9
|
+
Requires-Python: >=3.11
|
|
9
10
|
Classifier: Development Status :: 5 - Production/Stable
|
|
10
11
|
Classifier: Intended Audience :: Developers
|
|
11
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
12
12
|
Classifier: Natural Language :: English
|
|
13
13
|
Classifier: Operating System :: OS Independent
|
|
14
14
|
Classifier: Programming Language :: Python :: 3
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.11
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.12
|
|
17
17
|
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
18
19
|
Classifier: Topic :: Software Development :: Libraries
|
|
19
20
|
Project-URL: Bug Tracker, https://github.com/bluetooth-devices/ulid-transform/issues
|
|
20
21
|
Project-URL: Changelog, https://github.com/bluetooth-devices/ulid-transform/blob/main/CHANGELOG.md
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
ulid_transform/__init__.py,sha256=opPGyjUlw_adiochffkB-m5nqmFhds5x3Oz6S7-0V8U,894
|
|
2
|
+
ulid_transform/__init__.pyi,sha256=Ul-yd8ZQMOce7Oq-se3GdSuM0QSEaCXOnhLd-PdMvH4,478
|
|
3
|
+
ulid_transform/_py_ulid_impl.py,sha256=2kgDr2VjqV4IXoD3Vg0SQiz6lJ_gMnHO_5MOi8KmCvU,10698
|
|
4
|
+
ulid_transform/_ulid_impl.pyx,sha256=BM6xwD-JeiVI7AffEAZBV_EDcnT2PXTQpBfFdaW2384,4577
|
|
5
|
+
ulid_transform/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
|
+
ulid_transform/ulid_struct.hh,sha256=lQZ4IBftFJ_xujXQXzWFYBn6xdHDXQbWEiY_MN-Q98Y,10584
|
|
7
|
+
ulid_transform/ulid_uint128.hh,sha256=fsEvmDlXOKiLFNHBLpYwNhsnibsQZRuGR6KbV0HidKk,11677
|
|
8
|
+
ulid_transform/ulid_wrapper.cpp,sha256=ystSZzM9qUg3wQQN2Pm6hTHIyuIei1MpTwV8D-1IA-M,3115
|
|
9
|
+
ulid_transform/ulid_wrapper.h,sha256=trD8ygVx-k9ZJIVkR58OZiNCa-7XFI63EUOtgdX8wfY,518
|
|
10
|
+
ulid_transform/_ulid_impl.cp311-win32.pyd,sha256=gtfO-a-Es9FXAHBnnVp0YgVIbmowCQ0tfYBtnwTPWPc,53760
|
|
11
|
+
ulid_transform-1.5.2.dist-info/licenses/LICENSE,sha256=glXAnenXQvBuN4WzZ8ikikOHF6v3qq4_z8fCZobbgxs,1094
|
|
12
|
+
ulid_transform-1.5.2.dist-info/METADATA,sha256=vMtfUWYKGcFvVbpYXvdDqntiakuO0CQqtoC3AADg3zY,5619
|
|
13
|
+
ulid_transform-1.5.2.dist-info/WHEEL,sha256=nRq6-ye-AhTSGIWR5U8xaSzz3PVMAUSXbh4KwRhDnkM,94
|
|
14
|
+
ulid_transform-1.5.2.dist-info/RECORD,,
|
ulid_transform/ulid.hh
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
// Originally from https://github.com/suyash/ulid
|
|
2
|
-
|
|
3
|
-
#ifndef ULID_HH
|
|
4
|
-
#define ULID_HH
|
|
5
|
-
|
|
6
|
-
// http://stackoverflow.com/a/23981011
|
|
7
|
-
#ifdef __SIZEOF_INT128__
|
|
8
|
-
#define ULIDUINT128
|
|
9
|
-
#endif
|
|
10
|
-
|
|
11
|
-
#ifdef ULIDUINT128
|
|
12
|
-
#include "ulid_uint128.hh"
|
|
13
|
-
#else
|
|
14
|
-
#include "ulid_struct.hh"
|
|
15
|
-
#endif // ULIDUINT128
|
|
16
|
-
|
|
17
|
-
#endif // ULID_HH
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
ulid_transform/__init__.py,sha256=EYq5vghn8Uic68JIyunJXHO-JjGAnAIy5BCMYIOhV8s,894
|
|
2
|
-
ulid_transform/__init__.pyi,sha256=Ul-yd8ZQMOce7Oq-se3GdSuM0QSEaCXOnhLd-PdMvH4,478
|
|
3
|
-
ulid_transform/_py_ulid_impl.py,sha256=9JiwiUf9mCke90axriOYSAs_IlICYHi0R_dglB-6veg,10680
|
|
4
|
-
ulid_transform/_ulid_impl.pyx,sha256=BM6xwD-JeiVI7AffEAZBV_EDcnT2PXTQpBfFdaW2384,4577
|
|
5
|
-
ulid_transform/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
|
-
ulid_transform/ulid.hh,sha256=RwGduPUOt5AEfAaAkafGaHyhr2yd7vfHJeY0lOXlTPw,312
|
|
7
|
-
ulid_transform/ulid_struct.hh,sha256=Jh326iAyOkEaEpBZr4CY6xOOSXqO_hcsBS37qUcUCeM,20025
|
|
8
|
-
ulid_transform/ulid_uint128.hh,sha256=ibwgd8Qksjc0oG52h8kb7ClJruJe9CyfMQra4B3fk1E,15370
|
|
9
|
-
ulid_transform/ulid_wrapper.cpp,sha256=OLanExS7GGWBQzsc-BRk4hcrekXXny-GC_cqHlU_sz8,2892
|
|
10
|
-
ulid_transform/ulid_wrapper.h,sha256=3bK3iE2oeZ1h7Ze_sbdnGQJs4V6TbNpOtY-Eh0Q2VSo,519
|
|
11
|
-
ulid_transform/_ulid_impl.cp311-win32.pyd,sha256=M0Om9LuIOfNSz5GWSgq3DLgc9p10JQQU7T5y7XrMzGQ,45568
|
|
12
|
-
ulid_transform-1.3.0.dist-info/LICENSE,sha256=glXAnenXQvBuN4WzZ8ikikOHF6v3qq4_z8fCZobbgxs,1094
|
|
13
|
-
ulid_transform-1.3.0.dist-info/METADATA,sha256=hblzqdAfGHjHtVZgVNcwyXurojY4Sp3pBduG2ioQ_GY,5591
|
|
14
|
-
ulid_transform-1.3.0.dist-info/WHEEL,sha256=ZwbXs3_yG-zKHIpei8Ob72ezHKz3Yx8NWxBI6HtkIlw,94
|
|
15
|
-
ulid_transform-1.3.0.dist-info/RECORD,,
|
|
File without changes
|