Skip to content
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

"SHA256/lib.mo" does not exist #10

Open
Amitkma007 opened this issue Jul 27, 2021 · 4 comments
Open

"SHA256/lib.mo" does not exist #10

Amitkma007 opened this issue Jul 27, 2021 · 4 comments

Comments

@Amitkma007
Copy link

Amitkma007 commented Jul 27, 2021

I'm trying to import this package in my program. i want to make a function which takes a Text message in argument and returns the SHA256 hash of that message. but i'm not able to build the program . here is my code snipet.

import Array "mo:base/Array";
import Prim "mo:prim";
import Sha256 "./SHA256";
actor {

 public func getHash(text : Text) : async [Word8] {
   
 var a: [Word8] = [];
    for (c in text.chars()) {
        let word: Word8 = Prim.natToWord8(Prim.word32ToNat(Prim.charToWord32(c)));
        a := Array.append(a, [word]);
    };

    return Sha256.sha256(a);
};

};

I Got this Error :
import error [M0009], file "/home/sudesh/Dfinity/check_arg/src/check_arg/SHA256/lib.mo" does not exist

Please let me know if i need to do anything else.

@timohanke
Copy link

Can you try
import Sha256 "mo:sha256/SHA256"

It should be part of the standard packages now.

@troublesprouter
Copy link

import Sha256 “mo:sha256/SHA256”;
is giving me

package "sha256" not defined Motoko

Any idea how to fix it?

Do I need to npm install something or change a configuration file other than simply importing?

@TemidayoDavid
Copy link

Have you found the answer to this, i am also facing something similar

@timohanke
Copy link

Have you found the answer to this, i am also facing something similar

Please don't use this package anymore. It is outdated. The standard package for sha256 which is also maintained for latest dependencies is this one: https://mops.one/sha2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants