# for https://perlmonks.org/?node_id=11110997 # by bliako, 08/01/2020 use strict; use warnings; use Math::BigInt; use Digest::SHA qw(sha256_hex); for(my $i=1;$i<=10;$i++){ # the sha as a hex string (no '0x' prepended) my $hexstr = sha256_hex($i); # to create a bigint from a hex string we need to prepend '0x' to it my $digest = Math::BigInt->new('0x'.$hexstr); # specify accuracy and precision $digest->accuracy(80); $digest->precision(1); # operate print "$i $digest\n"; $digest /= 64; print "$i $digest\n"; } #### 1 48635463943209834798109814161294753926839975257569795305637098542720658922320 1 759929124112653668720465846270230530106874613399528051650579664730010295660 2 96094161643976066833367867971426158458230048495430276217795328666133331159860 2 1501471275687126044271372937053533725909844507741098065903052010408333299370 3 35293215426786447154857697798367884701614677727176325092965345248689205321680 3 551456491043538236794651528099498198462729339487130079577583519510768833150 4 33984360982413536682390860969296307922929415152052354251133793603654468157320 4 531005640350211510662357202645254811295772111750818035173965525057101064960 5 108182406554699997314868250957730053259073589402365819770572592736584172823450 5 1690350102417187458044816421214532082173024834411965933915196761509127700370 6 104920238006865337205013407090248200170018306865343388364051008767965015414400 6 1639378718857270893828334485785128127656536044770990443188297011999453365850 7 54734117258892461880478870895348100103198302433611928089023761078319507514450 7 855220582170194716882482357739814064112473475525186376390996266848742304910 8 20075373234943686845167158285967784892467090849631486320124245130906619831460 8 313677706795995106955736848218246638944798294525491973751941330170415934870 9 11463511883541201508393500803711559652562721115888819482889049505863143503290 9 179117373180331273568648450057993119571292517435762804420141398529111617240 10 33592815351635838866227505544683417564162321228075154218315436012476449103320 10 524887739869309982284804774135678399440036269188674284661178687694944517240