SDK Overview
SHA224.com provides official client libraries for seamless integration of SHA-224 hash functionality into your applications across major programming languages. Our SDKs offer consistent APIs, robust error handling, and performance optimizations to simplify your development experience.
Consistent API Design
All SDKs share a common API design, making it easy to switch between languages while maintaining familiar patterns.
Optimized Performance
Each SDK is optimized for performance in its target language, using native cryptographic primitives where available.
Comprehensive Error Handling
Robust error handling with clear, language-idiomatic exceptions and error messages to simplify debugging.
Well-Documented
Extensive documentation with getting started guides, API references, and practical examples for every SDK.
Available SDKs
Choose the SDK that best matches your development environment:
JavaScript / TypeScript
npm install @sha224/sdk
Client-side (browser) and server-side (Node.js) support with TypeScript definitions.
Python
pip install sha224-sdk
Compatible with Python 3.7+ with async/await support and type hints.
Java
implementation 'com.sha224:sha224-sdk:1.0.0'
Java 8+ SDK with both synchronous and asynchronous APIs.
Go
go get github.com/sha224/go-sdk
Idiomatic Go SDK with full concurrency support and context handling.
PHP
composer require sha224/sdk
PHP 7.4+ SDK with PSR-18 HTTP client compatibility.
C# / .NET
dotnet add package SHA224.SDK
.NET Standard 2.0+ SDK with async/await pattern.
Swift
.package(url: "https://github.com/sha224/swift-sdk", from: "1.0.0")
Swift 5.5+ SDK with async/await and Combine support.
Quick Start Example
Here's a basic example of using the SHA-224 SDK to generate a hash:
// Using the JavaScript SDK
// Browser
import { SHA224Client } from '@sha224/sdk';
// Node.js
// const { SHA224Client } = require('@sha224/sdk');
// Initialize the client
const client = new SHA224Client({
apiKey: 'YOUR_API_KEY', // Optional, for API mode
mode: 'auto' // 'local', 'api', or 'auto' (default)
});
// Generate a hash
async function generateHash() {
try {
// String input
const textHash = await client.hash('Hello, world!');
console.log('Text hash:', textHash);
// Binary input (file, ArrayBuffer, etc.)
const fileInput = document.getElementById('fileInput').files[0];
const fileHash = await client.hashFile(fileInput);
console.log('File hash:', fileHash);
// Verify a hash
const isValid = await client.verify('Hello, world!', textHash);
console.log('Verification result:', isValid);
} catch (error) {
console.error('Error:', error);
}
}
generateHash();
# Using the Python SDK
from sha224_sdk import SHA224Client
# Initialize the client
client = SHA224Client(
api_key="YOUR_API_KEY", # Optional, for API mode
mode="auto" # 'local', 'api', or 'auto' (default)
)
# Generate a hash
def generate_hash():
try:
# String input
text_hash = client.hash("Hello, world!")
print(f"Text hash: {text_hash}")
# Binary input (file, bytes, etc.)
with open("example.pdf", "rb") as f:
file_data = f.read()
file_hash = client.hash_bytes(file_data)
print(f"File hash: {file_hash}")
# File path input
file_path_hash = client.hash_file("example.pdf")
print(f"File path hash: {file_path_hash}")
# Verify a hash
is_valid = client.verify("Hello, world!", text_hash)
print(f"Verification result: {is_valid}")
except Exception as e:
print(f"Error: {e}")
# Async version
import asyncio
async def generate_hash_async():
# String input
text_hash = await client.hash_async("Hello, world!")
print(f"Async text hash: {text_hash}")
generate_hash()
asyncio.run(generate_hash_async())
// Using the Java SDK
import com.sha224.sdk.SHA224Client;
import com.sha224.sdk.SHA224Config;
import com.sha224.sdk.exception.SHA224Exception;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
public class SHA224Example {
public static void main(String[] args) {
// Initialize the client
SHA224Config config = new SHA224Config.Builder()
.apiKey("YOUR_API_KEY") // Optional, for API mode
.mode(SHA224Config.Mode.AUTO) // LOCAL, API, or AUTO (default)
.build();
SHA224Client client = new SHA224Client(config);
try {
// String input
String textHash = client.hash("Hello, world!");
System.out.println("Text hash: " + textHash);
// Binary input (byte array)
byte[] fileData = Files.readAllBytes(Paths.get("example.pdf"));
String fileHash = client.hash(fileData);
System.out.println("File hash: " + fileHash);
// File input
File file = new File("example.pdf");
String filePathHash = client.hashFile(file);
System.out.println("File path hash: " + filePathHash);
// Verify a hash
boolean isValid = client.verify("Hello, world!", textHash);
System.out.println("Verification result: " + isValid);
// Async version
client.hashAsync("Hello, world!")
.thenAccept(hash -> System.out.println("Async text hash: " + hash))
.exceptionally(ex -> {
System.err.println("Error: " + ex.getMessage());
return null;
});
} catch (SHA224Exception | IOException e) {
System.err.println("Error: " + e.getMessage());
}
}
}
// Using the Go SDK
package main
import (
"context"
"fmt"
"io/ioutil"
"log"
"github.com/sha224/go-sdk"
)
func main() {
// Initialize the client
config := sha224.Config{
APIKey: "YOUR_API_KEY", // Optional, for API mode
Mode: sha224.ModeAuto, // ModeLocal, ModeAPI, or ModeAuto (default)
}
client, err := sha224.NewClient(config)
if err != nil {
log.Fatalf("Failed to create client: %v", err)
}
// Create context
ctx := context.Background()
// String input
textHash, err := client.Hash(ctx, "Hello, world!")
if err != nil {
log.Fatalf("Failed to generate hash: %v", err)
}
fmt.Printf("Text hash: %s\n", textHash)
// Binary input (byte slice)
fileData, err := ioutil.ReadFile("example.pdf")
if err != nil {
log.Fatalf("Failed to read file: %v", err)
}
fileHash, err := client.HashBytes(ctx, fileData)
if err != nil {
log.Fatalf("Failed to generate file hash: %v", err)
}
fmt.Printf("File hash: %s\n", fileHash)
// File path input
filePathHash, err := client.HashFile(ctx, "example.pdf")
if err != nil {
log.Fatalf("Failed to generate file path hash: %v", err)
}
fmt.Printf("File path hash: %s\n", filePathHash)
// Verify a hash
isValid, err := client.Verify(ctx, "Hello, world!", textHash)
if err != nil {
log.Fatalf("Failed to verify hash: %v", err)
}
fmt.Printf("Verification result: %v\n", isValid)
}
SDK Features
Feature | Description | Availability |
---|---|---|
Local Processing | Hash generation using native language implementations | All SDKs |
API Integration | Hash generation via the SHA224.com REST API | All SDKs |
Automatic Mode | Intelligently switches between local and API based on input size and capabilities | All SDKs |
String Input | Hash generation from string data | All SDKs |
Binary Input | Hash generation from binary data (byte arrays, buffers, etc.) | All SDKs |
File Input | Hash generation directly from files | All SDKs |
Streaming Input | Hash generation from data streams without loading entire content into memory | JavaScript, Python, Java, Go, C#, Rust |
Asynchronous API | Non-blocking hash generation for responsive applications | JavaScript, Python, Java, C#, Swift, Rust |
Batch Processing | Efficient generation of multiple hashes in a single operation | All SDKs |
Verification | Verify data against an expected hash value | All SDKs |
Type Safety | Strong typing with language-appropriate type definitions | TypeScript, Python, Java, C#, Rust, Swift, Go |
Error Handling | Comprehensive error types with detailed messages | All SDKs |
Retry Logic | Automatic retries with exponential backoff for API calls | All SDKs |
Logging | Configurable logging for debugging and monitoring | All SDKs |
Custom HTTP Client | Support for custom HTTP clients for API calls | JavaScript, Python, Java, Go, PHP, C# |
Implementation Modes
All SHA224.com SDKs support three implementation modes to give you flexibility based on your application requirements:
Local Mode
Hash generation is performed entirely on your local system using native language implementations. This mode offers:
- Complete privacy - data never leaves your system
- No network latency or external dependencies
- Works offline with no internet connection
- Lower latency for small to medium data sizes
Ideal for privacy-sensitive applications, mobile apps, and situations where internet connectivity is limited.
API Mode
Hash generation is performed via the SHA224.com REST API. This mode offers:
- Server-side processing for resource-constrained clients
- Hardware-accelerated performance on our optimized infrastructure
- Consistent implementation across all platforms
- More efficient for very large files or high volumes
Ideal for web applications, serverless functions, and environments where computational resources are limited.
Auto Mode (Default)
Intelligently switches between local and API modes based on various factors:
- Input size (small inputs processed locally, large ones via API)
- Available system resources
- Network connectivity
- Hardware acceleration availability
Provides the best of both worlds with optimal performance based on current conditions. This is the recommended mode for most applications.
Installation
Each SDK follows the standard installation practices for its respective language and environment. Click on the individual SDK documentation pages for detailed installation instructions.
NPM (JavaScript/TypeScript)
npm install @sha224/sdk
# Or using yarn
yarn add @sha224/sdk
Pip (Python)
pip install sha224-sdk
# Or using poetry
poetry add sha224-sdk
Maven (Java)
<dependency>
<groupId>com.sha224</groupId>
<artifactId>sha224-sdk</artifactId>
<version>1.0.0</version>
</dependency>
Go Modules
go get github.com/sha224/go-sdk
For other languages and more detailed instructions, please refer to the language-specific SDK documentation.
Versioning and Compatibility
All SHA224.com SDKs follow semantic versioning (SemVer) principles to ensure predictable upgrades:
- Major version (X.y.z): Breaking changes that may require code modifications
- Minor version (x.Y.z): New features in a backward-compatible manner
- Patch version (x.y.Z): Backward-compatible bug fixes and enhancements
We recommend pinning to a major version (e.g., ^1.0.0
) to receive bug fixes and
non-breaking features while maintaining stability in your application.
Current SDK Versions
SDK | Latest Version | Minimum Language Version | API Compatibility |
---|---|---|---|
JavaScript/TypeScript | 1.2.0 | ES2018+ / TypeScript 4.0+ | v1 |
Python | 1.1.3 | Python 3.7+ | v1 |
Java | 1.0.5 | Java 8+ | v1 |
Go | 1.0.2 | Go 1.18+ | v1 |
Ruby | 1.0.0 | Ruby 2.7+ | v1 |
PHP | 1.0.1 | PHP 7.4+ | v1 |
C# / .NET | 1.0.3 | .NET Standard 2.0+ | v1 |
Rust | 0.9.0 | Rust 1.60+ | v1 |
Swift | 1.0.0 | Swift 5.5+ | v1 |
Getting Help
If you encounter any issues or have questions about the SDKs, there are several ways to get help: