Skip to content
This repository has been archived by the owner on Oct 17, 2023. It is now read-only.

Commit

Permalink
Merge pull request #389 from noir-lang/zpedro/scalar
Browse files Browse the repository at this point in the history
renaming scalar multiplication
  • Loading branch information
signorecello authored Sep 25, 2023
2 parents ef2850c + 93bb15a commit 777721d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 15 deletions.
2 changes: 1 addition & 1 deletion docs/modules_packages_crates/dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ You can also import only the specific parts of dependency that you want to use,

```rust
use dep::std::hash::sha256;
use dep::std::scalar_mul::fixed_base;
use dep::std::scalar_mul::fixed_base_embedded_curve;
```

Lastly, as demonstrated in the
Expand Down
20 changes: 7 additions & 13 deletions docs/standard_library/cryptographic_primitives/01_scalar.mdx
Original file line number Diff line number Diff line change
@@ -1,33 +1,27 @@
---
title: Scalar multiplication
description:
See how you can perform scalar multiplications over a fixed base in Noir
keywords:
[
cryptographic primitives,
Noir project,
scalar multiplication,
]
description: See how you can perform scalar multiplications over a fixed base in Noir
keywords: [cryptographic primitives, Noir project, scalar multiplication]
---

import BlackBoxInfo from './common/\_blackbox.mdx';
import BlackBoxInfo from './common/_blackbox.mdx';

## scalar_mul::fixed_base
## scalar_mul::fixed_base_embedded_curve

Performs scalar multiplication over the embedded curve whose coordinates are defined by the
configured noir field. For the BN254 scalar field, this is BabyJubJub or Grumpkin.

```rust
fn fixed_base(_input : Field) -> [Field; 2]
fn fixed_base_embedded_curve(_input : Field) -> [Field; 2]
```

example

```rust
fn main(x : Field) {
let scal = std::scalar_mul::fixed_base(x);
let scal = std::scalar_mul::fixed_base_embedded_curve(x);
std::println(scal);
}
```

<BlackBoxInfo/>
<BlackBoxInfo />
2 changes: 1 addition & 1 deletion docs/standard_library/merkle_trees.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ example:
*/
fn main(index: Field, priv_key: Field, secret: Field, note_hash_path: [Field; 3]) {

let pubkey = std::scalar_mul::fixed_base(priv_key);
let pubkey = std::scalar_mul::fixed_base_embedded_curve(priv_key);
let pubkey_x = pubkey[0];
let pubkey_y = pubkey[1];
let note_commitment = std::hash::pedersen([pubkey_x, pubkey_y, secret]);
Expand Down

0 comments on commit 777721d

Please sign in to comment.