pybase16384 0.3.3__cp312-cp312-macosx_10_9_universal2.whl → 0.3.6__cp312-cp312-macosx_10_9_universal2.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.

Potentially problematic release.


This version of pybase16384 might be problematic. Click here for more details.

@@ -6,18 +6,26 @@ from cpython.object cimport PyObject_HasAttrString
6
6
  from libc.stdint cimport int32_t, uint8_t
7
7
 
8
8
  from pybase16384.backends.cython.base16384 cimport (
9
- b14_decode, b14_decode_fd, b14_decode_file, b14_decode_len, b14_encode,
10
- b14_encode_fd, b14_encode_file, b14_encode_len,
11
- base16384_err_fopen_input_file, base16384_err_fopen_output_file,
12
- base16384_err_get_file_size, base16384_err_map_input_file,
13
- base16384_err_ok, base16384_err_open_input_file, base16384_err_t, BASE16384_ENCBUFSZ,
14
- BASE16384_DECBUFSZ,
9
+ BASE16384_DECBUFSZ, BASE16384_ENCBUFSZ, BASE16384_FLAG_NOHEADER,
10
+ BASE16384_FLAG_SUM_CHECK_ON_REMAIN, BASE16384_SIMPLE_SUM_INIT_VALUE,
11
+ b14_decode, b14_decode_fd, b14_decode_fd_detailed, b14_decode_file,
12
+ b14_decode_file_detailed, b14_decode_len, b14_encode, b14_encode_fd,
13
+ b14_encode_fd_detailed, b14_encode_file, b14_encode_file_detailed,
14
+ b14_encode_len, base16384_err_fopen_input_file,
15
+ base16384_err_fopen_output_file, base16384_err_get_file_size,
16
+ base16384_err_invalid_commandline_parameter,
17
+ base16384_err_invalid_decoding_checksum, base16384_err_invalid_file_name,
18
+ base16384_err_map_input_file, base16384_err_ok,
19
+ base16384_err_open_input_file, base16384_err_read_file, base16384_err_t,
15
20
  base16384_err_write_file, pybase16384_64bits)
16
21
 
17
22
  from pathlib import Path
18
23
 
19
24
  ENCBUFSZ = BASE16384_ENCBUFSZ
20
25
  DECBUFSZ = BASE16384_DECBUFSZ
26
+ FLAG_NOHEADER = BASE16384_FLAG_NOHEADER
27
+ FLAG_SUM_CHECK_ON_REMAIN = BASE16384_FLAG_SUM_CHECK_ON_REMAIN
28
+ SIMPLE_SUM_INIT_VALUE = BASE16384_SIMPLE_SUM_INIT_VALUE
21
29
 
22
30
  cdef inline bytes ensure_bytes(object inp):
23
31
  if isinstance(inp, unicode):
@@ -51,8 +59,7 @@ cpdef inline bytes _encode(const uint8_t[::1] data):
51
59
  with nogil:
52
60
  count = b14_encode(<const char*> &data[0],
53
61
  <int>length,
54
- output_buf,
55
- <int>output_size) # encode 整数倍的那个
62
+ output_buf) # encode 整数倍的那个
56
63
  try:
57
64
  return <bytes>output_buf[:count]
58
65
  finally:
@@ -68,8 +75,7 @@ cpdef inline bytes _decode(const uint8_t[::1] data):
68
75
  with nogil:
69
76
  count = b14_decode(<const char *> &data[0],
70
77
  <int> length,
71
- output_buf,
72
- <int> output_size) # decode
78
+ output_buf) # decode
73
79
  try:
74
80
  return <bytes> output_buf[:count]
75
81
  finally:
@@ -84,8 +90,7 @@ cpdef inline int _encode_into(const uint8_t[::1] data, uint8_t[::1] dest) except
84
90
  with nogil:
85
91
  return b14_encode(<const char *> &data[0],
86
92
  <int> input_size,
87
- <char *> &dest[0],
88
- <int> output_buf_size)
93
+ <char *> &dest[0])
89
94
 
90
95
  cpdef inline int _decode_into(const uint8_t[::1] data, uint8_t[::1] dest) except -1:
91
96
  cdef size_t input_size = data.shape[0]
@@ -96,8 +101,7 @@ cpdef inline int _decode_into(const uint8_t[::1] data, uint8_t[::1] dest) except
96
101
  with nogil:
97
102
  return b14_decode(<const char *> &data[0],
98
103
  <int> input_size,
99
- <char *> &dest[0],
100
- <int> output_buf_size)
104
+ <char *> &dest[0])
101
105
 
102
106
 
103
107
  def encode_file(object input,
@@ -140,7 +144,7 @@ def encode_file(object input,
140
144
  continue
141
145
  chunk_ptr = <const char*>PyBytes_AS_STRING(chunk)
142
146
  with nogil:
143
- count = b14_encode(chunk_ptr, <int>size, output_buf, <int> output_size)
147
+ count = b14_encode(chunk_ptr, <int>size, output_buf)
144
148
  output.write(<bytes>output_buf[:count])
145
149
  if size < 7:
146
150
  break
@@ -194,7 +198,7 @@ def decode_file(object input,
194
198
  input.seek(-2, 1)
195
199
  chunk_ptr = <const char *> PyBytes_AS_STRING(chunk)
196
200
  with nogil:
197
- count = b14_decode(chunk_ptr, <int> size, output_buf, <int> output_size)
201
+ count = b14_decode(chunk_ptr, <int> size, output_buf)
198
202
  output.write(<bytes>output_buf[:count])
199
203
  finally:
200
204
  PyMem_Free(output_buf)
@@ -215,6 +219,14 @@ cdef inline str err_to_str(base16384_err_t ret):
215
219
  return "base16384_err_open_input_file"
216
220
  elif ret == base16384_err_map_input_file:
217
221
  return "base16384_err_map_input_file"
222
+ elif ret == base16384_err_read_file:
223
+ return "base16384_err_read_file"
224
+ elif ret == base16384_err_invalid_file_name:
225
+ return "base16384_err_invalid_file_name"
226
+ elif ret == base16384_err_invalid_commandline_parameter:
227
+ return "base16384_err_invalid_commandline_parameter"
228
+ elif ret == base16384_err_invalid_decoding_checksum:
229
+ return "base16384_err_invalid_decoding_checksum"
218
230
 
219
231
  cpdef inline encode_local_file(object inp, object out):
220
232
  cdef bytes inp_name = ensure_bytes(inp)
@@ -295,3 +307,84 @@ cpdef inline decode_fd(int inp, int out):
295
307
  finally:
296
308
  PyMem_Free(encbuf)
297
309
  PyMem_Free(decbuf)
310
+
311
+ # detailed
312
+ cpdef inline encode_local_file_detailed(object inp, object out, int flag):
313
+ cdef bytes inp_name = ensure_bytes(inp)
314
+ cdef bytes out_name = ensure_bytes(out)
315
+ cdef const char * inp_name_ptr = <const char *> inp_name
316
+ cdef const char * out_name_ptr = <const char *> out_name
317
+ cdef char * encbuf = <char*>PyMem_Malloc(<size_t>BASE16384_ENCBUFSZ)
318
+ if encbuf == NULL:
319
+ raise MemoryError
320
+ cdef char * decbuf = <char*>PyMem_Malloc(<size_t>BASE16384_DECBUFSZ)
321
+ if decbuf == NULL:
322
+ PyMem_Free(encbuf)
323
+ raise MemoryError
324
+ cdef base16384_err_t ret
325
+ try:
326
+ with nogil:
327
+ ret = b14_encode_file_detailed(inp_name_ptr, out_name_ptr, encbuf, decbuf, flag)
328
+ if ret != base16384_err_ok:
329
+ raise ValueError(err_to_str(ret))
330
+ finally:
331
+ PyMem_Free(encbuf)
332
+ PyMem_Free(decbuf)
333
+
334
+ cpdef inline decode_local_file_detailed(object inp, object out, int flag):
335
+ cdef bytes inp_name = ensure_bytes(inp)
336
+ cdef bytes out_name = ensure_bytes(out)
337
+ cdef const char * inp_name_ptr = <const char *> inp_name
338
+ cdef const char * out_name_ptr = <const char *> out_name
339
+ cdef char * encbuf = <char*>PyMem_Malloc(<size_t>BASE16384_ENCBUFSZ)
340
+ if encbuf == NULL:
341
+ raise MemoryError
342
+ cdef char * decbuf = <char*>PyMem_Malloc(<size_t>BASE16384_DECBUFSZ)
343
+ if decbuf == NULL:
344
+ PyMem_Free(encbuf)
345
+ raise MemoryError
346
+ cdef base16384_err_t ret
347
+ try:
348
+ with nogil:
349
+ ret = b14_decode_file_detailed(inp_name_ptr, out_name_ptr, encbuf, decbuf, flag)
350
+ if ret != base16384_err_ok:
351
+ raise ValueError(err_to_str(ret))
352
+ finally:
353
+ PyMem_Free(encbuf)
354
+ PyMem_Free(decbuf)
355
+
356
+ cpdef inline encode_fd_detailed(int inp, int out, int flag):
357
+ cdef char * encbuf = <char *> PyMem_Malloc(<size_t>BASE16384_ENCBUFSZ)
358
+ if encbuf == NULL:
359
+ raise MemoryError
360
+ cdef char * decbuf = <char *> PyMem_Malloc(<size_t>BASE16384_DECBUFSZ)
361
+ if decbuf == NULL:
362
+ PyMem_Free(encbuf)
363
+ raise MemoryError
364
+ cdef base16384_err_t ret
365
+ try:
366
+ with nogil:
367
+ ret = b14_encode_fd_detailed(inp, out, encbuf, decbuf, flag)
368
+ if ret != base16384_err_ok:
369
+ raise ValueError(err_to_str(ret))
370
+ finally:
371
+ PyMem_Free(encbuf)
372
+ PyMem_Free(decbuf)
373
+
374
+ cpdef inline decode_fd_detailed(int inp, int out, int flag):
375
+ cdef char * encbuf = <char *> PyMem_Malloc(<size_t>BASE16384_ENCBUFSZ)
376
+ if encbuf == NULL:
377
+ raise MemoryError
378
+ cdef char * decbuf = <char *> PyMem_Malloc(<size_t>BASE16384_DECBUFSZ)
379
+ if decbuf == NULL:
380
+ PyMem_Free(encbuf)
381
+ raise MemoryError
382
+ cdef base16384_err_t ret
383
+ try:
384
+ with nogil:
385
+ ret = b14_decode_fd_detailed(inp, out, encbuf, decbuf, flag)
386
+ if ret != base16384_err_ok:
387
+ raise ValueError(err_to_str(ret))
388
+ finally:
389
+ PyMem_Free(encbuf)
390
+ PyMem_Free(decbuf)
@@ -7,6 +7,11 @@ from libc.stdio cimport FILE
7
7
  cdef extern from "base16384.h" nogil:
8
8
  int BASE16384_ENCBUFSZ
9
9
  int BASE16384_DECBUFSZ
10
+
11
+ int BASE16384_FLAG_NOHEADER
12
+ int BASE16384_FLAG_SUM_CHECK_ON_REMAIN
13
+ int BASE16384_SIMPLE_SUM_INIT_VALUE
14
+
10
15
  ctypedef enum base16384_err_t:
11
16
  base16384_err_ok
12
17
  base16384_err_get_file_size
@@ -15,15 +20,23 @@ cdef extern from "base16384.h" nogil:
15
20
  base16384_err_write_file
16
21
  base16384_err_open_input_file
17
22
  base16384_err_map_input_file
23
+ base16384_err_read_file
24
+ base16384_err_invalid_file_name
25
+ base16384_err_invalid_commandline_parameter
26
+ base16384_err_invalid_decoding_checksum
18
27
  # encode_len calc min buf size to fill encode result
19
28
  int b14_encode_len "base16384_encode_len" (int dlen)
20
29
  # decode_len calc min buf size to fill decode result
21
30
  int b14_decode_len "base16384_decode_len" (int dlen, int offset)
22
31
 
23
32
  # encode data and write result into buf
24
- int b14_encode "base16384_encode" (const char* data, int dlen, char* buf, int blen)
33
+ int b14_encode "base16384_encode" (const char* data, int dlen, char* buf)
34
+
35
+ int b14_encode_unsafe "base16384_encode_unsafe" (const char * data, int dlen, char * buf)
25
36
  # decode data and write result into buf
26
- int b14_decode "base16384_decode" (const char* data, int dlen, char* buf, int blen)
37
+ int b14_decode "base16384_decode" (const char* data, int dlen, char* buf)
38
+
39
+ int b14_decode_unsafe "base16384_decode_unsafe"(const char * data, int dlen, char * buf)
27
40
 
28
41
  base16384_err_t b14_encode_file "base16384_encode_file" (const char * input, const char * output, char * encbuf, char * decbuf)
29
42
  base16384_err_t b14_decode_file "base16384_decode_file" (const char * input, const char * output, char * encbuf, char * decbuf)
@@ -43,6 +56,34 @@ cdef extern from "base16384.h" nogil:
43
56
  # encbuf & decbuf must be no less than BASE16384_ENCBUFSZ & BASE16384_DECBUFSZ
44
57
  base16384_err_t b14_decode_fd "base16384_decode_fd"(int input, int output, char* encbuf, char* decbuf)
45
58
 
59
+ # detailed
60
+ # base16384_encode_file_detailed encodes input file to output file.
61
+ # use `-` to specify stdin/stdout
62
+ # encbuf & decbuf must be no less than BASE16384_ENCBUFSZ & BASE16384_DECBUFSZ
63
+ base16384_err_t b14_encode_file_detailed "base16384_encode_file_detailed" (const char* input, const char* output, char* encbuf, char* decbuf, int flag)
64
+
65
+ # base16384_encode_fp_detailed encodes input file to output file.
66
+ # encbuf & decbuf must be no less than BASE16384_ENCBUFSZ & BASE16384_DECBUFSZ
67
+ base16384_err_t b14_encode_fp_detailed "base16384_encode_fp_detailed" (FILE* input, FILE* output, char* encbuf, char* decbuf, int flag)
68
+
69
+ # base16384_encode_fd_detailed encodes input fd to output fd.
70
+ # encbuf & decbuf must be no less than BASE16384_ENCBUFSZ & BASE16384_DECBUFSZ
71
+ base16384_err_t b14_encode_fd_detailed "base16384_encode_fd_detailed" (int input, int output, char* encbuf, char* decbuf, int flag)
72
+
73
+ # base16384_decode_file_detailed decodes input file to output file.
74
+ # use `-` to specify stdin/stdout
75
+ # encbuf & decbuf must be no less than BASE16384_ENCBUFSZ & BASE16384_DECBUFSZ
76
+ base16384_err_t b14_decode_file_detailed "base16384_decode_file_detailed" (const char* input, const char* output, char* encbuf, char* decbuf, int flag)
77
+
78
+ # base16384_decode_fp_detailed decodes input file to output file.
79
+ # encbuf & decbuf must be no less than BASE16384_ENCBUFSZ & BASE16384_DECBUFSZ
80
+ base16384_err_t b14_decode_fp_detailed "base16384_decode_fp_detailed" (FILE* input, FILE* output, char* encbuf, char* decbuf, int flag)
81
+
82
+ # base16384_decode_fd_detailed decodes input fd to output fd.
83
+ # encbuf & decbuf must be no less than BASE16384_ENCBUFSZ & BASE16384_DECBUFSZ
84
+ base16384_err_t b14_decode_fd_detailed "base16384_decode_fd_detailed" (int input, int output, char* encbuf, char* decbuf, int flag)
85
+
86
+
46
87
  cdef extern from * nogil:
47
88
  """
48
89
  #ifdef CPUBIT32
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pybase16384
3
- Version: 0.3.3
3
+ Version: 0.3.6
4
4
  Summary: fast base16384 encode and decode
5
5
  Home-page: https://github.com/synodriver/pybase16384
6
6
  Author: synodriver
@@ -14,18 +14,17 @@ Classifier: Topic :: Security :: Cryptography
14
14
  Classifier: Programming Language :: C
15
15
  Classifier: Programming Language :: Cython
16
16
  Classifier: Programming Language :: Python
17
- Classifier: Programming Language :: Python :: 3.6
18
- Classifier: Programming Language :: Python :: 3.7
19
17
  Classifier: Programming Language :: Python :: 3.8
20
18
  Classifier: Programming Language :: Python :: 3.9
21
19
  Classifier: Programming Language :: Python :: 3.10
22
20
  Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
23
22
  Classifier: Programming Language :: Python :: Implementation :: CPython
24
23
  Classifier: Programming Language :: Python :: Implementation :: PyPy
25
24
  Requires-Python: >=3.6
26
25
  Description-Content-Type: text/markdown
27
26
  License-File: LICENSE
28
- Requires-Dist: cffi >=1.0.0
27
+ Requires-Dist: cffi (>=1.0.0)
29
28
 
30
29
  <h1 align="center"><i>✨ pybase16384 ✨ </i></h1>
31
30
 
@@ -0,0 +1,16 @@
1
+ pybase16384-0.3.6.dist-info/RECORD,,
2
+ pybase16384-0.3.6.dist-info/LICENSE,sha256=ixuiBLtpoK3iv89l7ylKkg9rs2GzF9ukPH7ynZYzK5s,35148
3
+ pybase16384-0.3.6.dist-info/WHEEL,sha256=FDh96Vll7rv1YrbfdYSeAi5C6IFBzvr4imtwQ_I1-lE,115
4
+ pybase16384-0.3.6.dist-info/top_level.txt,sha256=kXpl7pWjnjpm74qJP0SJg3JhbiWuwKQApJgkJH0B5Mk,12
5
+ pybase16384-0.3.6.dist-info/METADATA,sha256=PFDZlRqunJmn2MpmKZ8ltniUoCEE3eSmXwTpC5Wq5VM,5387
6
+ pybase16384/__init__.py,sha256=7GvQhJQVZAIGGSmUlq3LmdyQO3LInUlnha4Yeqbq8W8,2933
7
+ pybase16384/backends/__init__.py,sha256=vdW_t1O2WNfdRmxDlEXRvTpyJj5ufKWAUsD2fbtku5g,55
8
+ pybase16384/backends/cffi/build.py,sha256=d4Z9l6EF1yPwex5HmiMdQ-ANSHNtLeAiM3ksRnOZaas,4396
9
+ pybase16384/backends/cffi/__init__.py,sha256=CsRpcA_dhOqkPm0Cn9Wh_RxAeba5RYhyDDPQoV3BHX8,9507
10
+ pybase16384/backends/cffi/_core.abi3.so,sha256=G_gpFMKVDSZxIeez6SKorx2iYkSafNeP9XMgi1CfXBo,154432
11
+ pybase16384/backends/cython/_core.c,sha256=EJEvkeElNCEgAb4Sdw2AK4myOn7ybMsog7c92h_K014,1393172
12
+ pybase16384/backends/cython/__init__.py,sha256=iBis69sFYOO94e7CLK9V1SkjtYJZMTHGmGWYgOq6Fdk,551
13
+ pybase16384/backends/cython/base16384.pxd,sha256=ilQqiUp3FYxuibR_WTgAI079Q7FvAHCWWzW5fKBools,4654
14
+ pybase16384/backends/cython/_core.abi3.so,sha256=TTTEkDH4W9DGRS_ejSfAs8RXcKvze-wPqdnTc6JbRCQ,524816
15
+ pybase16384/backends/cython/_core.pyx,sha256=SlurBrEjfMkNit0kVDIJiATIJoGNRN5SPpb2v1g8NBM,15375
16
+ pybase16384/backends/cython/_core.pxi,sha256=2fXuRiumLqxO0bnmZVEz0lr_GX-grJGBfhGIVedfyt8,530
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.41.2)
2
+ Generator: bdist_wheel (0.40.0)
3
3
  Root-Is-Purelib: false
4
4
  Tag: cp312-cp312-macosx_10_9_universal2
5
5
 
@@ -1,16 +0,0 @@
1
- pybase16384/__init__.py,sha256=vcwJRHVB4J1MDtiyRmksNCHCcLrMQIIy8-oEwFLcBT8,2429
2
- pybase16384/backends/__init__.py,sha256=vdW_t1O2WNfdRmxDlEXRvTpyJj5ufKWAUsD2fbtku5g,55
3
- pybase16384/backends/cffi/__init__.py,sha256=YEI2qrjgZ0QOWX42GYOJQ31Govfm-eKUOn6mD5zfv-k,7463
4
- pybase16384/backends/cffi/_core_cffi.abi3.so,sha256=TN8K8ULZW7WYhl7AxVLsrlLzluZIZlBO936qZZr0oTE,119551
5
- pybase16384/backends/cffi/build.py,sha256=PFeGo-a78jgJpkZPdLtySxpkIOF3tJh6GpZjr5VNSvo,3013
6
- pybase16384/backends/cython/__init__.py,sha256=1DyejUxgY-G31e0u0JcpvgkZfFQr4X2SfXkooirwsUE,338
7
- pybase16384/backends/cython/_core_cy.c,sha256=-tWTg6j5Kwk8ci8p0EU5_-rtfw1MQlgnaD5jXTrcZH0,1296645
8
- pybase16384/backends/cython/_core_cy.cpython-312-darwin.so,sha256=3zkZmveh-plmvh8zt2wlYOVmabqZ-e2VYkw8K98G_mk,472747
9
- pybase16384/backends/cython/_core_cy.pyi,sha256=2fXuRiumLqxO0bnmZVEz0lr_GX-grJGBfhGIVedfyt8,530
10
- pybase16384/backends/cython/_core_cy.pyx,sha256=1ZddlA2z17N9QAUdar-o0oqH7GOTszUmUL8AIwcBIHk,11747
11
- pybase16384/backends/cython/base16384.pxd,sha256=e8PeVS8ulSqx8rMIU1oZa9n-dIPT4OxbjFl-l30Xmu4,2292
12
- pybase16384-0.3.3.dist-info/LICENSE,sha256=ixuiBLtpoK3iv89l7ylKkg9rs2GzF9ukPH7ynZYzK5s,35148
13
- pybase16384-0.3.3.dist-info/METADATA,sha256=qeZLek2cCgjkS_0QofcANuqrRJeyMrPw1YE0gIsbu90,5434
14
- pybase16384-0.3.3.dist-info/WHEEL,sha256=4d0TNF8ZO0MHZ4WlFdXxa_-Gb4s8Ug-mN1Bf_yzI0-s,115
15
- pybase16384-0.3.3.dist-info/top_level.txt,sha256=kXpl7pWjnjpm74qJP0SJg3JhbiWuwKQApJgkJH0B5Mk,12
16
- pybase16384-0.3.3.dist-info/RECORD,,
File without changes