PHPackages                             oswin.hu/crypto - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. oswin.hu/crypto

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

oswin.hu/crypto
===============

Crypto tool library

v1.0.1(3y ago)04MITPHPPHP &gt;=7.4

Since Jul 19Pushed 3y ago1 watchersCompare

[ Source](https://github.com/oswin-hu/Crypto)[ Packagist](https://packagist.org/packages/oswin.hu/crypto)[ RSS](/packages/oswinhu-crypto/feed)WikiDiscussions master Synced 5d ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

Crypto Currency for PHP
=======================

[](#crypto-currency-for-php)

A collection of common utilities and libraries in PHP for use with Bitcoin and Zetacoin compatable crypto currencies ustilizing the secp256k1 ECDSA curve.

The code may be messy and all over the place, but I'm still pulling things together as I merge this code base with items from the PHPECC codebase. The current features include:

- Private Key Generation and Loading
- Public Address Print Out
- Message Signing and Verification
- Address Generation and Validation
- Address compression, de-compression, encoding, and decoding.
- Supports Arbitrary Address Prefixes

Currently, the following items are working

- Base58.php
- SECp256k1.php
- PointMathGMP.php
- AddressValidation.php
- AddressCodec.php
- PrivateKey.php
- Signature.php

Usage
-----

[](#usage)

### AddressCodec

[](#addresscodec)

The AddressCodec class provides a simple interface for common Zetacoin/Bitcoin (and compatable) address functions. Load the following classes in your PHP code:

```
use Crypto\AddressCodec;
```

The most basic example, get the X and Y coordnates of a DER Encoded public key (old format)

```
$derPublicKey = '04a34b99f22c790c4e36b2b3c2c35a36db06226e41c692fc82b8b56ac1c540c5bd5b8dec5235a0fa8722476c7709c02559e3aa73aa03918ba2d492eea75abea235';

$point = AddressCodec::Point($derPublicKey);

echo $point['x'];
echo $point['y'];
```

That will return an array with both X and Y:

```
X = a34b99f22c790c4e36b2b3c2c35a36db06226e41c692fc82b8b56ac1c540c5bd
Y = 5b8dec5235a0fa8722476c7709c02559e3aa73aa03918ba2d492eea75abea235

```

The more usefull method is with the new compressed public keys used by modern crypto currencies:

```
$compressedPublicKey = '03a34b99f22c790c4e36b2b3c2c35a36db06226e41c692fc82b8b56ac1c540c5bd';

$point = AddressCodec::Decompress($compressedPublicKey);

echo $point['x'];
echo $point['y'];
```

Works the other way around too:

```
$compressedPublicKey = AddressCodec::Compress($point);
$derPublicKey = AddressCodec::Hex($point);
```

On to the more usefull items, Encode a public key into a Crypto Currency address. First Hash your public key then Encode it.

```
$hash = AddressCodec::Hash($compressedPublicKey);
$address = AddressCodec::Encode($hash);

echo $address;
```

Gives you:

```
Address = 1F3sAm6ZtwLAUnj7d38pGFxtP3RVEvtsbV

```

Specify your own prefix (in HEX):

```
$address = AddressCodec::Encode($hash, "50");
```

Gives you:

```
Address = ZS67wSwchNQFuTt3abnK4HjpjQ2x79YZed

```

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1396d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/09132288c0c7309333963089a7c55c378dfedf8de461574265eb33ece0eae492?d=identicon)[oswin](/maintainers/oswin)

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/oswinhu-crypto/health.svg)

```
[![Health](https://phpackages.com/badges/oswinhu-crypto/health.svg)](https://phpackages.com/packages/oswinhu-crypto)
```

###  Alternatives

[supercool/tablemaker

Create customizable and user-defined table fields.

40141.7k](/packages/supercool-tablemaker)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
