# bytes32

> Simply utility to convert string to bytes32

Latest version **0.0.3** (published 2020-07-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install bytes32
pnpm add bytes32
yarn add bytes32
bun add bytes32
```

Provides the command `bytes32`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2020-07-30 |
| First published | 2020-06-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | justin j moses |
| Maintainers | justinjmoses |

## Links

- npm: https://www.npmjs.com/package/bytes32
- npm.io page: https://npm.io/package/bytes32

## Recent versions

- 0.0.3 (latest) — 2020-07-30
- 0.0.2 — 2020-06-04
- 0.0.1 — 2020-06-01

## README

# Bytes32

Simple CLI tool to convert a string to `bytes32` for Ethereum. Always works in reverse if given a valid bytes32 input

## Usage:

```bash
$ npx bytes32
0x0000000000000000000000000000000000000000000000000000000000000000

$ npx bytes32 sETH
0x7345544800000000000000000000000000000000000000000000000000000000

$ npx bytes32 Something\ With\ Spaces
0x536f6d657468696e672057697468205370616365730000000000000000000000

$ npx bytes32 Supercalifragilisticexpialidocious
Error: Input string is too long, must be maximum of 32. It is currently 34

$ npx bytes32 Supercalifragilisticexpialidocious --ignore-length
0x537570657263616c6966726167696c697374696365787069616c69646f63696f7573

$ npx bytes32 0x7345544800000000000000000000000000000000000000000000000000000000
sETH

$ npx bytes32 7345544800000000000000000000000000000000000000000000000000000000
sETH
```

> To copy to clipboard on a mac, you can pipe to `pbcopy`.
>
>  ```bash
>  $ npx bytes32 sETH | pbcopy
>  ```


or in code:

```javascript
const bytes32 = require('bytes32');

console.log(bytes32({ input: 'sETH' }));
// 0x7345544800000000000000000000000000000000000000000000000000000000

console.log(bytes32({ input: 'Supercalifragilisticexpialidocious', ignoreLength: true }));
// 0x537570657263616c6966726167696c697374696365787069616c69646f63696f7573

console.log(bytes32({ input: '0x7345544800000000000000000000000000000000000000000000000000000000' }));
// sETH
```

---
_Source: https://npm.io/package/bytes32 · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
