Comments (4)
We have released scrypt v0.3
with no_std
support, also we now test that all crates can be built on WASM. So I think we can close this issue.
from password-hashes.
scrypt
depends on std
, which causes issues in your case. It can be solved by migrating it to alloc
, which will require bumping MSRV and thus releasing v0.3.0.
from password-hashes.
I'm not sure if this is just a simple misconfig-uration on my part, but I'm not able to get scrypt
running on wasm32-unknown-unknown
. According to this issue for the rand
crate, the "wasm-bindgen"
feature should be flagged for WASM compilation.
However, from past experience, rand
hasn't been the most reliable for WASM for me. The getrandom
crate supports WASM reliably; I wonder if it might be a good idea to switch to it. Here's my code:
# Cargo.toml
# ... snip ...
scrypt = "0.3"
// lib.rs
extern crate scrypt;
use scrypt::{ScryptParams, scrypt_check, scrypt_simple};
// ... snip ...
// in some function:
let params = ScryptParams::new(15, 8, 1).unwrap();
let password = "some password";
let hash = scrypt_simple(password, ¶ms).expect("Rng failed");
Compiled with:
$ cargo build --lib --release --target wasm32-unknown-unknown
When run, the script reports that the Rng failed. I'm not exactly sure where this error occurs - I think it might be while filling the salt with random values in scrypt_simple
. I'm going to try rewriting my own scrypt_simple
that doesn't depend on the same Rng and see if an error is still thrown.
from password-hashes.
Have you tried to add this line to your Cargo.toml?
getrandom = { version = "0.1", features = ["wasm-bindgen"] }
AFAIK rand
does not have any WASM-incompatible parts, so issue is usually that the getrandom
feature does not get enabled.
from password-hashes.
Related Issues (20)
- argon2: const ParamsBuilder HOT 5
- PBKDF2 defult number of rounds not correct? HOT 2
- argon2: make it works well with `thiserror`. HOT 2
- Mention in doc comment that `len` field of `scrypt::Params` is used only in `PasswordHasher` HOT 1
- Argon2: Max params
- `argon2::Error` does not implement `std::error::Error` HOT 1
- argon2: example in documentation doesn't compile with default feature flags HOT 5
- Possibility of `new` fns const? HOT 17
- Inconsistency between `hash_into` function names
- Will Base64ShaCrypt ever be supported ? HOT 1
- [Curiosity] Speed difference debug/release argon2 HOT 1
- Provide salt for sha512_simple() and sha256_simple()? HOT 2
- Argon2 - Freeing memory after use HOT 8
- [argon2] many tests fail on s390x, likely due to endianness issues HOT 5
- Argon2 - memory use HOT 2
- are these 2 different parameters basically the same? HOT 1
- `Sha256Params::new`'s `round` parameter should probably not be a `usize` HOT 1
- `sha256_crypt` doesn't need an error return HOT 1
- Why doesn't Argon2's update_address_block function do LE64 conversions? HOT 7
- Strange behavior of Argon2 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from password-hashes.