Skip to content

BCryptSwift v2.0.0

Choose a tag to compare

@logikonline logikonline released this 12 Aug 18:16
· 16 commits to master since this release

馃帀 Major Security & Modernization Update

This release brings significant security improvements and modernizes the codebase for Swift 5+.

馃攼 Security Enhancements

  • Secure Random Generation: Replaced arc4random() with SecRandomCopyBytes for cryptographically secure random number
    generation
  • Memory Security: Implemented secure memory cleanup for sensitive data
  • Timing Attack Protection: Added constant-time string comparison to prevent timing-based attacks
  • Input Validation: Enhanced validation for malicious inputs and edge cases

馃殌 New Features

  • Modern Swift API: New error-throwing API with proper Result types
  • Async/Await Support: Added async methods for iOS 13+/macOS 10.15+
  • Configuration Options: Flexible configuration with predefined security levels
  • Swift Package Manager: Full SPM support alongside CocoaPods
  • Comprehensive Test Suite: Added security-focused tests and edge case coverage

馃捇 API Improvements

// New modern API
let salt = try BCryptSwiftModern.generateSalt()
let hash = try BCryptSwiftModern.hashPassword("password", withSalt: salt)
let isValid = try BCryptSwiftModern.verifyPassword("password", matchesHash: hash)

// Async support
let hash = try await BCryptSwiftModern.hashPasswordAsync("password")

馃攧 Backward Compatibility

The legacy API remains fully compatible - existing code will continue to work without changes.

馃摝 Installation

Swift Package Manager:
.package(url: "https://github.com/wisetail/BCryptSwift.git", from: "2.0.0")

CocoaPods:
pod 'WisetailBCryptSwift'

馃檹 Credits

Based on the original BCryptSwift by Felipe Florencio Garcia, which was based on JKBCrypt by Joe Kramer.

馃搵 Full Changelog

  • Replaced insecure RNG with SecRandomCopyBytes
  • Added secure memory cleanup
  • Implemented constant-time comparison
  • Fixed division by zero bugs
  • Added modern Swift error handling
  • Added async/await support
  • Added comprehensive security tests
  • Updated for Swift 5+
  • Added GitHub Actions CI/CD
  • Fixed all SwiftLint warnings
  • Added security documentation