Metadata-Version: 2.5
Name: binarycalc
Version: 0.1.0
Summary: Binary, hex, octal and decimal conversion, text to binary, Morse code, LCM, GCF and factors, from the engine behind BinaryCalc.
Project-URL: Homepage, https://www.binarycalc.com/
Project-URL: Binary converter, https://www.binarycalc.com/binary-converter/
Project-URL: Binary to text, https://www.binarycalc.com/binary-to-text/
Project-URL: Morse code translator, https://www.binarycalc.com/morse-code-translator/
Project-URL: Source, https://github.com/mani-django09/binarycalc-engine
Author: BinaryCalc
License-Expression: MIT
License-File: LICENSE
Keywords: ascii,base conversion,binary,binary converter,binary to decimal,binary to text,decimal to binary,factors,gcd,gcf,hex,hexadecimal,lcm,morse code,octal,text to binary,twos complement,utf-8,webassembly
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Education
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Education
Classifier: Topic :: Scientific/Engineering :: Mathematics
Classifier: Topic :: Utilities
Requires-Python: >=3.9
Requires-Dist: wasmtime>=20
Description-Content-Type: text/markdown

# binarycalc

Number base conversion, text ↔ binary, Morse code, and LCM / GCF / factors for Python. It is the same Rust engine that runs **[BinaryCalc](https://www.binarycalc.com/)**, a set of free online converters that show their steps. The engine is compiled to WebAssembly and runs through [wasmtime](https://pypi.org/project/wasmtime/).

```sh
pip install binarycalc
```

```python
import binarycalc as bc

bc.convert("42", 10)["values"]       # {'2': '101010', '8': '52', '10': '42', '16': '2A'}
bc.text_to_binary("Hi")["binary"]    # '01001000 01101001'
bc.binary_to_text("01001000 01101001")["text"]  # 'Hi'
bc.text_to_morse("SOS")["morse"]     # '... --- ...'
bc.lcm("4, 6")["lcm"]                # '12'
bc.gcf("12 18")["gcf"]               # 6
bc.factors("12")["factors"]          # [1, 2, 3, 4, 6, 12]
```

Every function returns a dict. When `ok` is `False`, `error` holds a readable message.

## Functions

| Function | What it does | Online version |
|---|---|---|
| `convert(number, base=10)` | Converts between bases 2, 8, 10 and 16, with two's complement and steps | [Binary converter](https://www.binarycalc.com/binary-converter/) |
| `text_to_binary(text, separator="space")` | UTF-8 text to 8-bit binary | [Text to binary](https://www.binarycalc.com/text-to-binary/) |
| `binary_to_text(binary, separator="space")` | 8-bit binary back to text | [Binary to text](https://www.binarycalc.com/binary-to-text/) |
| `text_to_morse(text)` / `morse_to_text(morse)` | International Morse code | [Morse code translator](https://www.binarycalc.com/morse-code-translator/) |
| `lcm(numbers)` | Least common multiple, with steps | [LCM calculator](https://www.binarycalc.com/lcm-calculator/) |
| `gcf(numbers)` | Greatest common factor, with steps | [GCF calculator](https://www.binarycalc.com/gcf-calculator/) |
| `factors(numbers)` | Factors, prime factors and factor pairs | [Factor calculator](https://www.binarycalc.com/factor-calculator/) |
| `group_digits(text, size)` | `group_digits("101010", 4)` returns `'10 1010'` | |

`separator` is `"none"`, `"space"` or `"newline"`. The functions are safe to call from more than one thread.

## License

MIT
