Convert
A PowerShell module that simplifies object conversions by exposing common requirements as PowerShell functions.
Overview
Convert provides a comprehensive set of functions for converting between different data formats and types. Built with high-performance Rust libraries for optimal speed, it handles:
- Base64 encoding/decoding with multiple text encodings
- Byte array and memory stream conversions
- String compression and decompression
- Hash generation (MD5, SHA1, SHA256, SHA384, SHA512, HMAC)
- URL encoding/decoding
- Temperature conversions (Celsius/Fahrenheit)
- Unix timestamp conversions
- CLIXML serialization
- Case conversions (Title Case)
Installation
Install from the PowerShell Gallery:
# Install for current user
Install-Module -Name Convert -Scope CurrentUser
# Install for all users (requires admin)
Install-Module -Name Convert -Scope AllUsers
Quick Start
Base64 Encoding
# Convert string to Base64
'Hello, World!' | ConvertTo-Base64
# Output: SGVsbG8sIFdvcmxkIQ==
# Convert from Base64
'SGVsbG8sIFdvcmxkIQ==' | ConvertFrom-Base64
# Output: Hello, World!
Hash Generation
# Generate SHA256 hash
'Hello, World!' | ConvertTo-Hash -Algorithm SHA256
# Output: dffd6021bb2bd5b0af676290809ec3a53191dd81c7f70a4b28688a362182986f
# Generate HMAC-SHA256
'Hello, World!' | ConvertTo-HmacHash -Algorithm SHA256 -Key 'secret'
Memory Stream Operations
# Convert string to memory stream
$stream = 'Hello, World!' | ConvertTo-MemoryStream
# Convert memory stream back to string
$stream | ConvertFrom-MemoryStream
Functions
Requirements
- Windows PowerShell 5.1 or PowerShell 7.x
- Supported platforms: Windows (x64, ARM64), Linux (x64, ARM64, ARM), macOS (x64, ARM64)
Performance
Convert uses high-performance Rust libraries for core operations, providing significant speed improvements over pure PowerShell implementations, especially for:
- Large string/binary conversions
- Cryptographic operations
- Compression/decompression
- Memory-intensive operations
Contributing
Contributions are welcome! Please see the CONTRIBUTING.md guide for details.
# Clone the repository
git clone https://github.com/austoonz/Convert.git
cd Convert
# Install dependencies
.\install_modules.ps1
# Build the module (includes Rust compilation)
.\build.ps1 -Build
# Run tests
.\build.ps1 -Test
License
This project is licensed under the MIT License - see the LICENSE file for details.