-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Argon2 implementation #47
Conversation
Ping me when you'll be ready for the review |
I'm truly sorry, this would take much more time than I expected (due to lack of time and I've accidentally made some weird bugs I can't catch yet π ). |
no problem. I can understand you π |
I need a bit of your help, @TheBestTvarynka π For some weird reason, the input (and all other elements) do not show up π€· |
@Jujumba I'll look at this tonight after the work π |
You would better sleep at night π
|
@Jujumba, this is the cause of your problem (see the image above). impl From<&Argon2Action> for bool {
fn from(value: &Argon2Action) -> Self {
match value {
Argon2Action::Hash(_) => false,
Argon2Action::Verify(_) => true,
}
}
} |
Thanks π |
What do you think, should I implement pub struct Argon2HashAction {
pub memory: u32,
pub iters: u32,
pub paralelism: u32,
pub output_len: u32,
pub salt: Vec<u8>,
pub variant: Argon2Variant,
pub version: Argon2Version
} Or it's better to use hashing-config from I tend to the second option, but maybe it's more convenient for you to have a home-baked configuration. |
@Jujumba you can take the one from the library. I'm OK with it. I don't think we'll need an additional functionality, so go ahead |
Nevermind, I just realized it's impossible due to serialization :) |
I think computational part is somehow ready for review |
Ah, and sorry if some lines you didn't expect to be changed were changed
|
great, can you fix merge conflicts first? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you for your work. I appreciate this. I left some comments. ping me when you fix them
Recently I've cleaned my laptop from windows, but had forgotten to push some changes, so I'll start some things over. Sorry π π |
no problem β€οΈ |
I'm going to ask a bit stupid question, but I've been banging my head over the wall for the last 20 minutes with that: How to fix these merge conflicts?.. Sorry for the inconvenience |
You can look on new changes But there are still bugs (π) And this one (which seems extra weird) Or perhaps this is not even a bug π€·ββοΈ Edit: the last one persists despite of salt's length. Any salt ending with Edit2: I've dug a bit deeper: The returned hash is encoded in b64 with no padding. Data encoded in which format does function |
looks good. about bugs:
maybe. you should play with base64 formats (with and without padding)
in bytes. if the output from the lib is in the b64 format, then decode it and return as plain bytes |
Thanks, I've got that working. But the weirdness seems to come from Encoding The data is derived before encoding to plain bytes. "Translated" to UTF-8 it means the following: Edit: I was encoding b64 to b64 π After the fix, issue still persists, I'll "investigate" it later Edit2: I forgot to mention you: @TheBestTvarynka |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good code but I always find something to fix π
- run
cargo clippy --all-targets --all-features -- -D warnings
- run
cargo +nightly fmt --all
argon2 = "0.5.2" | ||
password-hash = "0.5.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
argon2 = "0.5.2" | |
password-hash = "0.5.0" | |
argon2 = "0.5" | |
password-hash = "0.5" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the UI of the argon2 input can be improved, but it's not a blocker
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- run
cargo +nightly fmt --all -- --check
- run
cargo clippy -- -D warnings
I guess I'm not meant to fix that? error: unused imports: `ByteInputProps`, `ByteInput`
--> src/common/mod.rs:7:40
|
7 | pub use byte_input::{build_byte_input, ByteInput, ByteInputProps};
| ^^^^^^^^^ ^^^^^^^^^^^^^^
|
= note: `-D unused-imports` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(unused_imports)]`
error: unused imports: `BytesViewerProps`, `BytesViewer`
--> src/common/mod.rs:8:24
|
8 | pub use bytes_viewer::{BytesViewer, BytesViewerProps};
| ^^^^^^^^^^^ ^^^^^^^^^^^^^^^^
error: unused import: `CheckboxProps`
--> src/common/mod.rs:9:30
|
9 | pub use checkbox::{Checkbox, CheckboxProps};
| ^^^^^^^^^^^^^
error: unused import: `SwitchProps`
--> src/common/mod.rs:11:26
|
11 | pub use switch::{Switch, SwitchProps};
| ^^^^^^^^^^^
error: unused imports: `KrbInputData`, `KrbInput`, `KrbMode`, `RSA_HASH_ALGOS`
--> src/crypto_helper.rs:9:32
|
9 | pub use algorithm::{Algorithm, KrbInput, KrbInputData, KrbMode, RSA_HASH_ALGOS};
| ^^^^^^^^ ^^^^^^^^^^^^ ^^^^^^^ ^^^^^^^^^^^^^^
error: unused import: `jwt::Jwt as JwtData`
--> src/jwt.rs:11:9
|
11 | pub use jwt::Jwt as JwtData;
| ^^^^^^^^^^^^^^^^^^^ As here no lints applied to my code |
@Jujumba please, fix the formatting ones but leave the |
@Jujumba will you fix the merge conflicts or do I have to do it? |
They are already fixed, aren't they? |
I really would like to delegate that work on you. Sorry π |
closes #4