Coder Social home page Coder Social logo

libdigest-raku's People

Contributors

arnsholt avatar froggs avatar grondilu avatar lizmat avatar melezhik avatar moritz avatar niner avatar retupmoca avatar samcv avatar tokuhirom avatar ugexe avatar zoffixznet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

libdigest-raku's Issues

CI tests fail - Parse errors: No plan found in TAP output

Hi! Here is a full report - https://ci.sparrowhub.io/report/2069

for some reasons I get this:

00:34:43 :: [Digest] Test Summary Report
00:34:43 :: [Digest] -------------------
00:34:43 :: [Digest] t/rfc4231.t (Wstat: 0 Tests: 7 Failed: 0)
00:34:43 :: [Digest]   Parse errors: No plan found in TAP output
00:34:43 :: [Digest] Files=4, Tests=25, 11 wallclock secs ( 0.05 usr  0.01 sys + 16.73 cusr  1.03 csys = 17.82 CPU)
00:34:43 :: [Digest] Result: FAIL

not sure why ... all tests seem to pass, broken tap output?

Name collision with the Digest::HMAC module broke a number of dependents

Now that this module exposes Digest::HMAC, it breaks the module with that exact name because use Digest::HMAC (or even zef install Digest::HMAC apparently, under some circumstances) now might dispatch to your package, rather than the module, hence possibly breaking any old module that didn't specify an auth.

I'm going to check if something could be done about it on the zef side (under somewhat related issue ugexe/zef#227). I ask you as well to think about solutions, please.

Docs Example Fails

this example from the raku docs...

use Digest::MD5;
my $password = "password123";
my $hashed-password = Digest::MD5.new.md5_hex($password);

say $hashed-password;

fails with

~/scum > raku scum.raku
You cannot create an instance of this type (Digest::MD5)
  in block <unit> at scum.raku line 4

we are using this to install...

zef install Digest::MD5

pulls from Digest

===> Staging Digest:ver<1.1.0>:auth<zef:grondilu>
===> Staging [OK] for Digest:ver<1.1.0>:auth<zef:grondilu>
===> Testing: Digest:ver<1.1.0>:auth<zef:grondilu>
===> Testing [OK] for Digest:ver<1.1.0>:auth<zef:grondilu>
===> Installing: Digest:ver<1.1.0>:auth<zef:grondilu>

there is a chat on Discord / IRC here
https://discord.com/channels/538407879980482560/768511641758466088/1234871258760478720

Work more like P5 Digest using Strategy

One of the great things about P5 Digest is I could have a digest object, know it's interface and use it regardless of algorithm. For something like a password hashing program where I might want to allow people to change algorithms this is critical. Below is some speculative thought on how algorithm and implementation

 my $digest = Digest.new(
      algorithm            => 'MD5',
      implementation => 'PP', # JVM/Native by default should select the fastest for current platform
      rounds                  => 5000,  # for algorthims that support such things,
      # additional arguments passed to the digester
 ); # new should return a Digester interface

I think that Digester's should follow a naming convention of Digest::PP::MD5 Digest::JVM::MD5 Digest::Native::MD5 this convention allows for numerous implementations of the algorithm, but aimed at performance on a given platform, where a native JVM MD5 is probably a better choice than either Pure Perl or Native code on that platform. In theory one could also ultimately select Digest::Clojure::MD5 on JVM, should such a module exist.

Digester inteface should at least impliment

Digester.add( @chunks );
Digester.reset; # start over
Digester.digest; # return binary

At some point it might be worth it to design a separate encoding role that a Digester has composed.

Digester.endoded_as('Base64');

Or maybe we just need a Strategy based encoder

 Encoder.new('Base64').encode( Digest.new(...).add( $data ).digest );

Please "git tag" your RAKU modules with it's versions

Can you please "GIT TAG" your RAKU modules with it's version, similar and at the same time you maintain it's "version": "x.y.z" in your META6.json file?

I was told, this will happen "for free" going forward with mi6 anyhow, but for now it would be great if you spend those 2 seconds already now :)

"Tagging" is generally highly appreciated in regards to "reproducible builds" and here especially for the "Rakudo Star" modules

THANK YOU!

Too slow to be practical?

Hi. I don't know if this is deserving of an issue, but I tried to use it, and found it too slow to be practical. Running sha256 on 66kb file takes about 11 seconds; using the 'sha256sum' command, it takes less than a tenth. Other hashes are similarly slow

Fails to install on Windows and Fedora

I am running Raku 2022.07 and Windows 10. [Coke] was also able to reproduce this error with Raku 2022.04.

Output of zef install Digest::SHA:

===> Searching for: Digest::SHA
===> Testing: Digest:ver<0.17.1>
[Digest] Cannot unbox negative bigint into native unsigned integer
[Digest]   in sub infix:«<<<» at C:\Users\[redacted]\.zef\tmp\Digest%3Aver%3C0.17.1%3E%3Aauth%3Cgithub%3Agrondilu%3E.tar.gz\libdigest-raku-master\lib\Digest.rakumod (Digest) line 47
[Digest]   in block  at C:\Users\[redacted]\.zef\tmp\Digest%3Aver%3C0.17.1%3E%3Aauth%3Cgithub%3Agrondilu%3E.tar.gz\libdigest-raku-master\lib\Digest.rakumod (Digest) line 69
[Digest]   in sub md5 at C:\Users\[redacted]\.zef\tmp\Digest%3Aver%3C0.17.1%3E%3Aauth%3Cgithub%3Agrondilu%3E.tar.gz\libdigest-raku-master\lib\Digest.rakumod (Digest) line 65
[Digest]   in block <unit> at t\digest.t line 15
===> Testing [FAIL]: Digest:ver<0.17.1>
Aborting due to test failure: Digest:ver<0.17.1> (use --force-test to override)

zeroed target thread ID in work pass

On Rakudo Star 2014.09 with MoarVM backend on OS X:

$ ./perl6 -e 'use Digest::SHA;  sha1 "foo" for ^14'
Internal error: zeroed target thread ID in work pass

Any lower number of iterations is fine.

Digest test failing on Rakudo 2017.04.3-235-gdc5eece built on MoarVM version 2017.04-64-g6d5ea04

$ perl6 --version
This is Rakudo version 2017.04.3-235-gdc5eece built on MoarVM version 2017.04-64-g6d5ea04

===> Testing: Digest:ver('0.3.4'):auth('Lucien Grondin')
t/digest.t .. ok
t/ripemd.t .. ok
# Failed test 'sha256'
# at t/sha.t line 12
t/sha.t .....1/2# expected: 'fbc1a9f858ea9e177916964bd88c3d37b91a1e84412765e29950777f265c4b75'
#      got: 'd7d04233b3a8427b7798817eae45cb70c7c24cfcc6740c2b44fb7aa823662036'
# Looks like you failed 1 test of 2
t/sha.t ..... Dubious, test returned 1
Failed 1/2 subtests 

It failed in my travis build here

failing zef install (no useful info)

    ===> Testing: Digest:ver<0.18.5>
    ===> Testing [FAIL]: Digest:ver<0.18.5>
    Aborting due to test failure: Digest:ver<0.18.5> (use --force-test to override)

macOS: 12.6 Monterey

❯ rakudo --version
Welcome to Rakudo™ v2022.07.
Implementing the Raku® Programming Language v6.d.
Built on MoarVM version 2022.07.

broken on latest perl6-m

==> Set PERL6LIB=/home/tokuhirom/dev/libdigest-perl6/lib
==> prove -e /home/tokuhirom/.rakudobrew/bin/../moar-nom/install/bin/perl6 -r t
t/digest.t .. ok
t/ripemd.t .. Too few positionals passed; expected 4 arguments but got 1
  in code  at /home/tokuhirom/dev/libdigest-perl6/lib/Digest/RIPEMD.pm:59
  in sub rmd160 at /home/tokuhirom/dev/libdigest-perl6/lib/Digest/RIPEMD.pm:59
  in block <unit> at t/ripemd.t:5

t/ripemd.t .. No subtests run
t/sha.t ..... Too few positionals passed; expected 4 arguments but got 1
  in code  at /home/tokuhirom/dev/libdigest-perl6/lib/Digest/SHA.pm:77
  in sub sha256 at /home/tokuhirom/dev/libdigest-perl6/lib/Digest/SHA.pm:77
  in block <unit> at t/sha.t:9

t/sha.t ..... Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 2/2 subtests

Test Summary Report
-------------------
t/ripemd.t (Wstat: 0 Tests: 0 Failed: 0)
  Parse errors: No plan found in TAP output
t/sha.t   (Wstat: 65280 Tests: 0 Failed: 0)
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 2 tests but ran 0.
Files=3, Tests=3, 19 wallclock secs ( 0.05 usr  0.02 sys + 18.72 cusr  0.45 csys = 19.24 CPU)
Result: FAIL
$ perl6-m --version
This is perl6 version 2015.09-239-ge2ff161 built on MoarVM version 2015.09-53-g5075f5b

md5() crashes with Cannot unbox negative bigint...

Looks like smth was broken with 289a042:

Digest:ver<0.8.2>:auth<Lucien Grondin>
[kostas@webtech-omen core-perl6]$ zef install "Digest:ver<0.8.2>"
===> Searching for: Digest:ver<0.8.2>
===> Testing: Digest:ver<0.8.2>
===> Testing [OK] for Digest:ver<0.8.2>
===> Installing: Digest:ver<0.8.2>
[kostas@webtech-omen core-perl6]$ raku -MDigest -e "md5('158.389').say";
Blob:0x<1D 83 F5 B9 D9 6A F1 A2 5F 36 38 42 31 03 BE 1B>
[kostas@webtech-omen core-perl6]$ zef uninstall Digest
===> Uninstalled from inst#/opt/rakudo/rakudo-star-2022.04/share/perl6/site
Digest:ver<0.8.2>:auth<Lucien Grondin>

[kostas@webtech-omen core-perl6]$ zef install "Digest:ver<0.9.0>"
===> Searching for: Digest:ver<0.9.0>
===> Testing: Digest:ver<0.9.0>
===> Testing [OK] for Digest:ver<0.9.0>
===> Installing: Digest:ver<0.9.0>
[kostas@webtech-omen core-perl6]$ raku -MDigest -e "md5('158.389').say";
Cannot unbox negative bigint into native unsigned integer
  in sub infix:«<<<» at /opt/rakudo/rakudo-star-2022.04/share/perl6/site/sources/08D38337202051EEADB24BAFC11F43DA5C064BAA (Digest) line 6
  in sub md5-block at /opt/rakudo/rakudo-star-2022.04/share/perl6/site/sources/08D38337202051EEADB24BAFC11F43DA5C064BAA (Digest) line 35
  in sub md5 at /opt/rakudo/rakudo-star-2022.04/share/perl6/site/sources/08D38337202051EEADB24BAFC11F43DA5C064BAA (Digest) line 47
  in sub md5 at /opt/rakudo/rakudo-star-2022.04/share/perl6/site/sources/08D38337202051EEADB24BAFC11F43DA5C064BAA (Digest) line 43
  in block <unit> at -e line 1

Looks relevant to #27 and #28.

It crashes on latest version as well:

[kostas@webtech-omen core-perl6]$ zef install Digest
===> Searching for: Digest
===> Testing: Digest:ver<0.23.1>
===> Testing [OK] for Digest:ver<0.23.1>
===> Installing: Digest:ver<0.23.1>
[kostas@webtech-omen core-perl6]$ raku -MDigest::MD5 -e "md5('158.389').say";
Cannot unbox negative bigint into native unsigned integer
  in block  at /opt/rakudo/rakudo-star-2022.04/share/perl6/site/sources/09B6112E2626A59F08A91D5D4762CC9F145C0515 (Digest::MD5) line 15
  in sub md5 at /opt/rakudo/rakudo-star-2022.04/share/perl6/site/sources/09B6112E2626A59F08A91D5D4762CC9F145C0515 (Digest::MD5) line 10
  in sub md5 at /opt/rakudo/rakudo-star-2022.04/share/perl6/site/sources/09B6112E2626A59F08A91D5D4762CC9F145C0515 (Digest::MD5) line 4
  in block <unit> at -e line 1

test hangs and eats all ram

[jdv@wieldy ~]$ panda install IO::Socket::SSL
==> IO::Socket::SSL depends on OpenSSL
==> OpenSSL depends on Digest
==> Fetching Digest
==> Building Digest
Compiling lib/Digest.pm to mbc
Compiling lib/Digest/SHA.pm to mbc
Compiling lib/Digest/RIPEMD.pm to mbc
==> Testing Digest
t/digest.t .. ok
t/ripemd.t .. ok

...and then it set about consuming all ram...

[jdv@wieldy ~]$ perl6 -v
This is perl6 version 2015.06-318-gf971dbd built on MoarVM version 2015.06-98-gf22142b
[jdv@wieldy ~]$

fails to install on macos with openssl@1 and openssl@3 brew packages installed

> $ prove6 --lib -v t/*                                             [±master ✓]
1..7
ok 1 - d41d8cd98f00b204e9800998ecf8427e is MD5 digest of ''
ok 2 - 0cc175b9c0f1b6a831c399e269772661 is MD5 digest of 'a'
ok 3 - 900150983cd24fb0d6963f7d28e17f72 is MD5 digest of 'abc'
ok 4 - f96b697d7cb7938d525a2f31aaf161d0 is MD5 digest of 'message digest'
ok 5 - c3fcd3d76192e4007dfb496cca67e13b is MD5 digest of 'abcdefghijklmnopqrstuvwxyz'
ok 6 - d174ab98d277d9f5a5611c2c9f419d9f is MD5 digest of 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
ok 7 - 57edf4a22be3c955ac49da2e2107b67a is MD5 digest of '12345678901234567890123456789012345678901234567890123456789012345678901234567890'
t/digest.t .. ok
1..8
ok 1 - RIPEMD()
ok 2 - RIPEMD(a)
ok 3 - RIPEMD(abc)
ok 4 - RIPEMD(message digest)
ok 5 - RIPEMD(abcdefghijklmnopqrstuvwxyz)
ok 6 - RIPEMD(abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq)
ok 7 - RIPEMD(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789)
ok 8 - RIPEMD(12345678901234567890123456789012345678901234567890123456789012345678901234567890)
t/ripemd.t .. ok
1..9
ok 1 - SHA-1(abc)
ok 2 - SHA-1(abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq)
ok 3 - SHA-256(abc)
ok 4 - SHA-256(abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq)
ok 5 - SHA-512(abc)
ok 6 - SHA-512(abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu)
unknown option '-mac'
options are
-c              to output the digest with separating colons
-d              to output debug info
-hex            output as hex dump
-binary         output in binary form
-sign   file    sign digest using private key in file
-verify file    verify a signature using public key in file
-prverify file  verify a signature using private key in file
-keyform arg    key file format (PEM or ENGINE)
-signature file signature to verify
-binary         output in binary form
-hmac key       create hashed MAC with key
-engine e       use engine e, possibly a hardware device.
-md5            to use the md5 message digest algorithm (default)
-md4            to use the md4 message digest algorithm
-md2            to use the md2 message digest algorithm
-sha1           to use the sha1 message digest algorithm
-sha            to use the sha message digest algorithm
-sha224         to use the sha224 message digest algorithm
-sha256         to use the sha256 message digest algorithm
-sha384         to use the sha384 message digest algorithm
-sha512         to use the sha512 message digest algorithm
-mdc2           to use the mdc2 message digest algorithm
-ripemd160      to use the ripemd160 message digest algorithm
# Failed test at t/sha.t line 23
# The spawned command 'openssl' exited unsuccessfully (exit code: 1, signal: 0)
not ok 7 -
unknown option '-mac'
options are
-c              to output the digest with separating colons
-d              to output debug info
-hex            output as hex dump
-binary         output in binary form
-sign   file    sign digest using private key in file
-verify file    verify a signature using public key in file
-prverify file  verify a signature using private key in file
-keyform arg    key file format (PEM or ENGINE)
-signature file signature to verify
-binary         output in binary form
-hmac key       create hashed MAC with key
-engine e       use engine e, possibly a hardware device.
-md5            to use the md5 message digest algorithm (default)
-md4            to use the md4 message digest algorithm
-md2            to use the md2 message digest algorithm
-sha1           to use the sha1 message digest algorithm
-sha            to use the sha message digest algorithm
-sha224         to use the sha224 message digest algorithm
-sha256         to use the sha256 message digest algorithm
-sha384         to use the sha384 message digest algorithm
-sha512         to use the sha512 message digest algorithm
-mdc2           to use the mdc2 message digest algorithm
-ripemd160      to use the ripemd160 message digest algorithm
# Failed test at t/sha.t line 24
# The spawned command 'openssl' exited unsuccessfully (exit code: 1, signal: 0)
not ok 8 -
unknown option '-mac'
options are
-c              to output the digest with separating colons
-d              to output debug info
-hex            output as hex dump
-binary         output in binary form
-sign   file    sign digest using private key in file
-verify file    verify a signature using public key in file
-prverify file  verify a signature using private key in file
-keyform arg    key file format (PEM or ENGINE)
-signature file signature to verify
-binary         output in binary form
-hmac key       create hashed MAC with key
-engine e       use engine e, possibly a hardware device.
-md5            to use the md5 message digest algorithm (default)
-md4            to use the md4 message digest algorithm
-md2            to use the md2 message digest algorithm
-sha1           to use the sha1 message digest algorithm
-sha            to use the sha message digest algorithm
-sha224         to use the sha224 message digest algorithm
-sha256         to use the sha256 message digest algorithm
-sha384         to use the sha384 message digest algorithm
-sha512         to use the sha512 message digest algorithm
-mdc2           to use the mdc2 message digest algorithm
-ripemd160      to use the ripemd160 message digest algorithm
# Failed test at t/sha.t line 25
# The spawned command 'openssl' exited unsuccessfully (exit code: 1, signal: 0)
# You failed 3 tests of 9

Issue with σ in expressions

C:\Users\nsharrok\Documents>panda install Digest
==> Fetching Digest
==> Building Digest
Compiling lib\Digest.pm to pir
Compiling lib\Digest\RIPEMD.pm to pir
Compiling lib\Digest\SHA.pm to pir
===SORRY!=== Error while compiling lib\Digest\SHA.pm
Two terms in a row
at lib\Digest\SHA.pm:94
------> my $⏏σ0 = [+^] map { rotr @h[0], $_ }, 2, 13,
expecting any of:
scoped declarator
constraint
postfix
infix stopper
infix or meta-infix
statement end
statement modifier
statement modifier loop
build stage failed for Digest: Failed building lib\Digest\SHA.pm
in method install at C:/rakudo/lib/parrot/6.10.0/languages/perl6/lib/Panda.pm:138
in method resolve at C:/rakudo/lib/parrot/6.10.0/languages/perl6/lib/Panda.pm:193
in sub MAIN at C:\rakudo\bin\panda:21
in sub MAIN at C:\rakudo\bin\panda:21
in block at C:\rakudo\bin\panda:77

Failure Summary

Digest
*build stage failed for Digest: Failed building lib\Digest\SHA.pm

Its the use of σ in lines 94, to 97 on a Windows 8 box

        my $σ0 = [+^] map { rotr @h[0], $_ }, 2, 13, 22;
        my $σ1 = [+^] map { rotr @h[4], $_ }, 6, 11, 25;
        my $t1 = [⊕] @h[7], $σ1, $ch, $K[$j], @w[$j];
        my $t2 = $σ0 ⊕ $maj;

Changed to o $o0 and $o1 from $σ0 and $σ1 and it compiles without issue.

Noel

Not passing tests in Ubuntu 20, openssl 1.1.1f

This is what it says

[Digest] Cannot unbox 65 bit wide bigint into native integer
[Digest]   in sub rotl at /home/jmerelo/.zef/tmp/Digest%3Aver%3C0.7.3%3E%3Aauth%3Cgithub%3Agrondilu%3E.tar.gz/libdigest-raku-master/lib/Digest/RIPEMD.rakumod (Digest::RIPEMD) line 12
[Digest]   in block  at /home/jmerelo/.zef/tmp/Digest%3Aver%3C0.7.3%3E%3Aauth%3Cgithub%3Agrondilu%3E.tar.gz/libdigest-raku-master/lib/Digest/RIPEMD.rakumod (Digest::RIPEMD) line 71
[Digest]   in sub rmd160 at /home/jmerelo/.zef/tmp/Digest%3Aver%3C0.7.3%3E%3Aauth%3Cgithub%3Agrondilu%3E.tar.gz/libdigest-raku-master/lib/Digest/RIPEMD.rakumod (Digest::RIPEMD) line 62
[Digest]   in sub rmd160 at /home/jmerelo/.zef/tmp/Digest%3Aver%3C0.7.3%3E%3Aauth%3Cgithub%3Agrondilu%3E.tar.gz/libdigest-raku-master/lib/Digest/RIPEMD.rakumod (Digest::RIPEMD) line 10
[Digest]   in block <unit> at t/ripemd.t line 18

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.