Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yeahnotsewerside/rbytes
"Real" bytes in python, because standard bytes() doesn't work properly with bitwise operations
https://github.com/yeahnotsewerside/rbytes
bitwise-operators bytes bytes-python python3
Last synced: about 10 hours ago
JSON representation
"Real" bytes in python, because standard bytes() doesn't work properly with bitwise operations
- Host: GitHub
- URL: https://github.com/yeahnotsewerside/rbytes
- Owner: YeahNotSewerSide
- License: mit
- Created: 2020-10-31T14:25:07.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2020-12-21T02:41:15.000Z (almost 4 years ago)
- Last Synced: 2024-07-16T13:38:52.758Z (4 months ago)
- Topics: bitwise-operators, bytes, bytes-python, python3
- Language: Python
- Homepage:
- Size: 19.5 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# RBytes
"Real" bytes in python, because standart bytes() doesn't work properlyI wrote that because bytes() in python doesn't allow to do bit shiftings and other bitwise operations
# Installation
pip install RBytes# Some Examples
```python
from RBytes import RBytesbyte_array = RBytes(b'\x01\x01\x01\x01')
result = byte_array << 5 #bitwise left shift
```
```python
from RBytes import RBytes
import structconverted_int = struct.pack('i',69) #get 4 bytes
byte_array = RBytes(converted_int) #get 'real' bytes
result = byte_array << 5 #bitwise left shift
```