mirror of
https://github.com/billbuchanan/appliedcrypto.git
synced 2026-02-22 03:37:57 +00:00
67 lines
1.0 KiB
Markdown
67 lines
1.0 KiB
Markdown
convert-string
|
|
==============
|
|
|
|
JavaScript component to convert to/from strings and byte arrays.
|
|
|
|
AMD/CommonJS compatible.
|
|
|
|
|
|
Install
|
|
-------
|
|
|
|
### Node.js/Browserify
|
|
|
|
npm install --save convert-string
|
|
|
|
|
|
### Component
|
|
|
|
component install cryptocoin/convert-string
|
|
|
|
|
|
### Bower
|
|
|
|
bower install convert-string
|
|
|
|
|
|
### Script
|
|
|
|
```html
|
|
<script src="/path/to/convert-string.js"></script>
|
|
```
|
|
|
|
|
|
Usage
|
|
-----
|
|
|
|
### stringToBytes(str)
|
|
|
|
### bytesToString(bytes)
|
|
|
|
### UTF8.stringToBytes(str)
|
|
|
|
### UTF8.bytesToString(bytes)
|
|
|
|
|
|
Credits
|
|
-------
|
|
|
|
Loosely inspired by code from here: https://github.com/vbuterin/bitcoinjs-lib & CryptoJS
|
|
|
|
|
|
References on JavaScript UTF-8 forced encoding
|
|
----------------------------------------------
|
|
|
|
(these sources are also included as PDFs in the repo in case the links go dead)
|
|
|
|
- http://ecmanaut.blogspot.com/2006/07/encoding-decoding-utf8-in-javascript.html
|
|
- http://hossa.in/2012/07/20/utf-8-in-javascript.html
|
|
|
|
|
|
|
|
License
|
|
-------
|
|
|
|
(MIT License)
|
|
|
|
Copyright 2013, JP Richardson <jprichardson@gmail.com> |