Calculate Hashes/s

How can I calculate how many hashes I generate per second?

I have a function which generates hashes from a string:

string GenerateHash(string plainText);

I generate as many hashes as possible with 4 threads.

How do I calculate how many hashes (or megahashes) I generate per second?

Your problem breaks down nicely into 3 separate tasks

  1. Sharing a single count variable across threads
  2. Benchmarking thread completion time
  3. Calculating hashes per/second

Sharing a single count variable across threads

public static class GlobalCounter
{ public static int Value { get;
private set;
} public static void Increment()
{ Value =GetNextValue(Value);
} private static int GetNextValue(int curValue) { returnInterlocked.Increment(ref curValue);
} public static void Reset() { Value = 0; } }

Before you spin off the threads call GlobalCounter.Reset and then in each thread (after each successful hash) you would call GlobalCounter.Increment – using Interlocked.X performs atomic operations of Value in a thread-safe manner, it’s also much faster than lock.

Benchmarking thread completion time

var sw = Stopwatch.StartNew(); Parallel.ForEach(someCollection, someValue => 
{ // generate hash GlobalCounter.Increment();
}); sw.Stop();

Parallel.ForEach will block until all threads have finished

Calculating hashes per second

... sw.Stop(); var hashesPerSecond = GlobalCounter.Value / sw.Elapsed.Seconds;

Did you find this article helpful?

If so, please consider a donation to help the evolution and development of more helpful articles in the future, and show your support for alternative articles.

Your generosity is 💚 ly appreciated

You can donate in any crypto your 💚 desires 😊

Thank you all for your time !!!

✌ & 💚

Bitcoin (BTC) :
1P1tTNFGRZabK65RhqQxVmcMDHQeRX9dJJ

LiteCoin(LTC) :
LYAdiSpsTJ36EWCJ5HF9EGy9iWGCwoLhed

Ethereum(ETH) :
0x602e8Ca3984943cef57850BBD58b5D0A6677D856

EthereumClassic(ETC) :
0x602e8Ca3984943cef57850BBD58b5D0A6677D856

Cardano(ADA)
addr1q88c5cccnrqy6xesszzvf7rd4tcz87klt0m0h6uvltywqe8txwmsrrqdnpq27594tyn9vz59zv0n8367lvyc2atvrzvqlvdm9d

BinanceCoin(BNB)
bnb1wwfnkzs34knsrv2g026t458l0mwp5a3tykeylx

BitcoinCash (BCH)
1P1tTNFGRZabK65RhqQxVmcMDHQeRX9dJJ

BitcoinSV(BSV)
1P1tTNFGRZabK65RhqQxVmcMDHQeRX9dJJ

ZCash(ZEC)
t1fSSQX4gEhove9ngcvFafQaMPq5dtNNsNF

Dash(DASH)
XcWmbFw1VmxEPxvF9CWdjzKXwPyDTrbMwj

Shiba(SHIB)
0x602e8Ca3984943cef57850BBD58b5D0A6677D856

Tron(TRX)
TCsJJkqt9xk1QZWQ8HqZHnqexR15TEowk8

Stellar(XLM)
GBL4UKPHP2SXZ6Y3PRF3VRI5TLBL6XFUABZCZC7S7KWNSBKCIBGQ2Y54

Made with 💚 by Free Spirit

✌ & 💚

Anarchy Legacy

A Crypto Anarchist’s Legacy

Airfoil Dec 20, 2018

Timothy May on the cover of the second issue of Wired magazine with 2 fellow cypherpunks

Sadly, this past week we lost an icon that helped to spur the cypherpunk movement. Timothy May, who wrote The Crypto Anarchist Manifesto in 1988, lauched a movement that is still very prominent today.

For the uninitiated, a Crypto-Anarchist focuses on subverting the current laws and using new technologies to the benefit of the common man.

In the original manifesto, May says crypto-anarchy focuses on “encryption, digital money, anonymous networks, digital pseudonyms, zero-knowledge, reputations, information markets, black markets, collapse of governments”.

The manifesto was written just before the first crypto wars began during the early 1990’s.

The governments of the world fiercely opposed the general public using cryptographic encryption protocols.

The idea that a normal citizen could completely hide what they say in an electronic message was their biggest concern.

The governments cited national security as a concern (We’ve heard this excuse used many times before).

Tim May was embroiled in the center of this alongside his group of fellow cypherpunks.

RSA Security, a leading computer securty company founded by world-renowned cryptologists, created this poster against a hardware chip that used a US-government supplied encryption standard

The legislation of the anti-encryption laws would also affect payment processing technology. There was a large push back from tech companies that would have to deal with these issues first-hand.

The crypto wars of the 1990’s ended with the concession from the government that encryption was readily available around the world.

The public had won their first bout against the government surveillance state. Alongside the public, you had the cypherpunks and large tech companies that were all fighting a common threat.

There was not much of an issue in terms of encryption for quite a few more years.

Every few years afterward, the idea of backdoors into encryption schemes were brought up but nothing ever came about these new ideations.

The Crypto Wars Redux

The expansion of computational power and development of more efficient processing equipment closed the gap as to who can gain access to encryption software.

The widespread availabilty of software/hardware that can perform these cryptographic calculations involved in encryption and the ease of use has made it possible for the layman to encrypt their own personal messages, video calls,emails, and notes.

Encrypting an email with someone who has never imported a key to their keyring, or generated their own PGP public/private key pair is a thing of the past.

Many of the services that exist today offer these solutions out of the box. The process has become much easier for all parties involved.

Anyone that is now using this technology benefits from this on a privacy and security level.

With all parties benefitting, the leviathan rears its head once more. Australia has passed an anti-encryption bill that will force large tech companies to allow the Australian government to obtain hardware access(citing national security as a major reason).

Outrage has spilled out of the larger tech companies. The end-to-end zero knowledge messaging/calling app, Signal, has taken a stand against this bill.

This sounds very similar to the issues Tim May was battling with during the early days of the First Crypto War.

The cypherpunks came out on top and I’m sure this legislation will face a similar fate.

May’s Impact on the World

The imprint that Timothy May left on the world is profound. The mass adoption of encryption as well as cryptocurrencies shows just how far ahead of the times he was.

May urged the importance of privacy.

He insisted on the use of encryption to keep your communications private.

Currently on a majority of mobile phones there are applications that provide encrypted communications. Whatsapp uses the Signal protocol which was developed by cypherpunk Moxie Marlinspike.

The rise of cryptocurrencies is an ideal that May was very hopeful for.

May did come out against the anti-privacy issues of bitcoin.

There are projects that offer solutions for this privacy debate.

Much of the developer-base of these certain cryptocurrencies have their foundation based in the cypherpunk tradition.

The Cryptocurrencies that aim for a privacy by default mechanism are monero and the soon to launch GRIN which uses the Mimblewimble Protocol (To see an extremely entertaining introduction to the GRIN project via talk-to-text chat for privacy preservation, listen to the creator of Grin).

Zcash is moving in the direction of private by default and the superior cryptography of the ZK range proofs will help to create a very private cryptocurrency.

Cody WIlson and Amir Taaki who worked on projects focused on the crypto-anarchic tradition including Dark Wallet and Defense Distributed

The impact Tim May made on the world by helping to create a social movement shows the importance and strength of his ideals.

He has impacted a generation of people that are growing up in the digital age.

He influenced builders in the 21st century.

You have people creating new currencies, exposing government surveillance on a national scale, circumventing the broken bueracratic system by creating their own markets, anonymous internet protocols, as well as making encryption applicable to the common man (You can find a list of prominent cypherpunks here and also here).

There isn’t enough that can be said about the applications in which he believed could positively affect us.

May was cognizant of the encroaching all-seeing eye of the state but I believe we are in much better shape now than we’ve ever been.

There may be negative news about what we currently face as individuals, from the unprecedented surveillance of the Snowden leaks to the aforementioned Australian anti-encryption bill, but looking at the grand scheme of our daily lives, these tools and their functions have helped to create a much better day than May could have imagined in 1988.

He was a proponent for the industriousness of human nature to outpace the slow moving regulation that would try to bog down any progress.

You can listen here to what he thought people/creators should do when they develop ground breaking technology.

Arise, you have nothing to lose but your barbed wire fences!

Timothy C. May – “The Crypto Anarchist Manifesto”

Shared with 💚 by Free Spirit

✌ & 💚

Arise…

Timothy C. May

Arise, you have nothing to lose but your barbed wired fences!

Timothy C. May

Wonder In Peace bright mind!

Thanks for the guidance and wisdom!

The world will never know how much they owe you!

✌ & 💚


Shared with 💚 by Free Spirit
& 💚



B-Money

Web Dai – B-Money

I am fascinated by Tim May's crypto-anarchy. 

Unlike the communities
traditionally associated with the word "anarchy", in a crypto-anarchy the
government is not temporarily destroyed but permanently forbidden and
permanently unnecessary.

It's a community where the threat of violence is
impotent because violence is impossible, and violence is impossible because its participants cannot be linked to their true names or physical locations.
 
Until now it's not clear, even theoretically, how such a community could operate.

A community is defined by the cooperation of its participants, and efficient cooperation requires a medium of exchange (money) and a way to enforce contracts.

Traditionally these services have been provided by the government or government sponsored institutions and only to legal entities.

In this article I describe a protocol by which these services can be provided to and by untraceable entities.
 
I will actually describe two protocols. The first one is impractical,because it makes heavy use of a synchronous and unjammable anonymous
broadcast channel. However it will motivate the second, more practical protocol.

In both cases I will assume the existence of an untraceable network, where senders and receivers are identified only by digital
pseudonyms (i.e. public keys) and every messages is signed by its sender
and encrypted to its receiver.
 
In the first protocol, every participant maintains a (seperate) database of how much money belongs to each pseudonym. These accounts collectively define the ownership of money, and how these accounts are updated is the subject of this protocol.
 
1. The creation of money. Anyone can create money by broadcasting the
solution to a previously unsolved computational problem. The only
conditions are that it must be easy to determine how much computing effort
it took to solve the problem and the solution must otherwise have no
value, either practical or intellectual. The number of monetary units
created is equal to the cost of the computing effort in terms of a
standard basket of commodities. For example if a problem takes 100 hours
to solve on the computer that solves it most economically, and it takes 3
standard baskets to purchase 100 hours of computing time on that computer
on the open market, then upon the broadcast of the solution to that
problem everyone credits the broadcaster's account by 3 units.
 
2. The transfer of money. If Alice (owner of pseudonym K_A) wishes to
transfer X units of money to Bob (owner of pseudonym K_B), she broadcasts
the message "I give X units of money to K_B" signed by K_A.
 
Upon the broadcast of this message, everyone debits K_A's account by X units and
credits K_B's account by X units, unless this would create a negative
balance in K_A's account in which case the message is ignored.
 
3. The effecting of contracts. A valid contract must include a maximum
reparation in case of default for each participant party to it. It should
also include a party who will perform arbitration should there be a
dispute. All parties to a contract including the arbitrator must broadcast
their signatures of it before it becomes effective. Upon the broadcast of
the contract and all signatures, every participant debits the account of
each party by the amount of his maximum reparation and credits a special
account identified by a secure hash of the contract by the sum the maximum
reparations. The contract becomes effective if the debits succeed for
every party without producing a negative balance, otherwise the contract
is ignored and the accounts are rolled back. A sample contract might look
like this:
 
K_A agrees to send K_B the solution to problem P before 0:0:0 1/1/2000.
K_B agrees to pay K_A 100 MU (monetary units) before 0:0:0 1/1/2000. K_C
agrees to perform arbitration in case of dispute. K_A agrees to pay a
maximum of 1000 MU in case of default. K_B agrees to pay a maximum of 200
MU in case of default. K_C agrees to pay a maximum of 500 MU in case of
default.
 
4. The conclusion of contracts. If a contract concludes without dispute,
each party broadcasts a signed message "The contract with SHA-1 hash H
concludes without reparations." or possibly "The contract with SHA-1 hash
H concludes with the following reparations: ..." Upon the broadcast of all
signatures, every participant credits the account of each party by the
amount of his maximum reparation, removes the contract account, then
credits or debits the account of each party according to the reparation
schedule if there is one.
 
5. The enforcement of contracts. If the parties to a contract cannot agree
on an appropriate conclusion even with the help of the arbitrator, each
party broadcasts a suggested reparation/fine schedule and any arguments or
evidence in his favor. Each participant makes a determination as to the
actual reparations and/or fines, and modifies his accounts accordingly.
 
In the second protocol, the accounts of who has how much money are kept by
a subset of the participants (called servers from now on) instead of
everyone. These servers are linked by a Usenet-style broadcast channel.

The format of transaction messages broadcasted on this channel remain the
same as in the first protocol, but the affected participants of each
transaction should verify that the message has been received and
successfully processed by a randomly selected subset of the servers.
 
Since the servers must be trusted to a degree, some mechanism is needed to
keep them honest. Each server is required to deposit a certain amount of
money in a special account to be used as potential fines or rewards for
proof of misconduct. Also, each server must periodically publish and
commit to its current money creation and money ownership databases. Each
participant should verify that his own account balances are correct and
that the sum of the account balances is not greater than the total amount
of money created. This prevents the servers, even in total collusion, from
permanently and costlessly expanding the money supply. New servers can
also use the published databases to synchronize with existing servers.
 
The protocol proposed in this article allows untraceable pseudonymous
entities to cooperate with each other more efficiently, by providing them
with a medium of exchange and a method of enforcing contracts. The
protocol can probably be made more efficient and secure, but I hope this
is a step toward making crypto-anarchy a practical as well as theoretical
possibility.
 
-------
 
Appendix A: alternative b-money creation
 
One of the more problematic parts in the b-money protocol is money
creation. This part of the protocol requires that all of the account
keepers decide and agree on the cost of particular computations.
Unfortunately because computing technology tends to advance rapidly and
not always publicly, this information may be unavailable, inaccurate, or
outdated, all of which would cause serious problems for the protocol.
 
So I propose an alternative money creation subprotocol, in which account
keepers (everyone in the first protocol, or the servers in the second
protocol) instead decide and agree on the amount of b-money to be created
each period, with the cost of creating that money determined by an
auction. Each money creation period is divided up into four phases, as
follows:
 
1. Planning. The account keepers compute and negotiate with each other to
determine an optimal increase in the money supply for the next period.

Whether or not the account keepers can reach a consensus, they each
broadcast their money creation quota and any macroeconomic calculations
done to support the figures.
 
2. Bidding. Anyone who wants to create b-money broadcasts a bid in the
form of <x, y> where x is the amount of b-money he wants to create, and y
is an unsolved problem from a predetermined problem class. Each problem in
this class should have a nominal cost (in MIPS-years say) which is
publicly agreed on.
 
3. Computation. After seeing the bids, the ones who placed bids in the
bidding phase may now solve the problems in their bids and broadcast the
solutions.
 
4. Money creation. Each account keeper accepts the highest bids (among
those who actually broadcasted solutions) in terms of nominal cost per
unit of b-money created and credits the bidders' accounts accordingly

http://www.weidai.com/bmoney.txt

Shared with 💚 by Free Spirit

✌ & 💚

Hal Finney

” Bitcoin and me (Hal Finney)

March 19, 2013, 08:40:02 PM
Last edit: March 25, 2013, 08:37:28 PM by Hal

 #1

I thought I’d write about the last four years, an eventful time for Bitcoin and me.

For those who don’t know me, I’m Hal Finney. I got my start in crypto working on an early version of PGP, working closely with Phil Zimmermann. When Phil decided to start PGP Corporation, I was one of the first hires. I would work on PGP until my retirement.

At the same time, I got involved with the Cypherpunks. I ran the first cryptographically based anonymous remailer, among other activities.

Fast forward to late 2008 and the announcement of Bitcoin.

I’ve noticed that cryptographic graybeards (I was in my mid 50’s) tend to get cynical. I was more idealistic; I have always loved crypto, the mystery and the paradox of it.

When Satoshi announced Bitcoin on the cryptography mailing list, he got a skeptical reception at best. Cryptographers have seen too many grand schemes by clueless noobs. They tend to have a knee jerk reaction.

I was more positive. I had long been interested in cryptographic payment schemes.

Plus I was lucky enough to meet and extensively correspond with both Wei Dai and Nick Szabo, generally acknowledged to have created ideas that would be realized with Bitcoin.

I had made an attempt to create my own proof of work based currency, called RPOW. So I found Bitcoin facinating.

When Satoshi announced the first release of the software, I grabbed it right away.

I think I was the first person besides Satoshi to run bitcoin.

I mined block 70-something, and I was the recipient of the first bitcoin transaction, when Satoshi sent ten coins to me as a test.

I carried on an email conversation with Satoshi over the next few days, mostly me reporting bugs and him fixing them.

Today, Satoshi’s true identity has become a mystery. But at the time, I thought I was dealing with a young man of Japanese ancestry who was very smart and sincere.

I’ve had the good fortune to know many brilliant people over the course of my life, so I recognize the signs.

After a few days, bitcoin was running pretty stably, so I left it running.

Those were the days when difficulty was 1, and you could find blocks with a CPU, not even a GPU.

I mined several blocks over the next days. But I turned it off because it made my computer run hot, and the fan noise bothered me.

In retrospect, I wish I had kept it up longer, but on the other hand I was extraordinarily lucky to be there at the beginning.

It’s one of those glass half full half empty things.

The next I heard of Bitcoin was late 2010, when I was surprised to find that it was not only still going, bitcoins actually had monetary value.

I dusted off my old wallet, and was relieved to discover that my bitcoins were still there.

As the price climbed up to real money, I transferred the coins into an offline wallet, where hopefully they’ll be worth something to my heirs.

Speaking of heirs, I got a surprise in 2009, when I was suddenly diagnosed with a fatal disease. I was in the best shape of my life at the start of that year, I’d lost a lot of weight and taken up distance running. I’d run several half marathons, and I was starting to train for a full marathon. I worked my way up to 20+ mile runs, and I thought I was all set. That’s when everything went wrong.

My body began to fail. I slurred my speech, lost strength in my hands, and my legs were slow to recover.

In August, 2009, I was given the diagnosis of ALS, also called Lou Gehrig’s disease, after the famous baseball player who got it.

ALS is a disease that kills moter neurons, which carry signals from the brain to the muscles. It causes first weakness, then gradually increasing paralysis. It is usually fatal in 2 to 5 years.

My symptoms were mild at first and I continued to work, but fatigue and voice problems forced me to retire in early 2011. Since then the disease has continued its inexorable progression.

Today, I am essentially paralyzed. I am fed through a tube, and my breathing is assisted through another tube. I operate the computer using a commercial eyetracker system. It also has a speech synthesizer, so this is my voice now. I spend all day in my power wheelchair. I worked up an interface using an arduino so that I can adjust my wheelchair’s position using my eyes.

It has been an adjustment, but my life is not too bad. I can still read, listen to music, and watch TV and movies. I recently discovered that I can even write code. It’s very slow, probably 50 times slower than I was before. But I still love programming and it gives me goals.

Currently I’m working on something Mike Hearn suggested, using the security features of modern processors, designed to support “Trusted Computing”, to harden Bitcoin wallets. It’s almost ready to release. I just have to do the documentation.

And of course the price gyrations of bitcoins are entertaining to me. I have skin in the game. But I came by my bitcoins through luck, with little credit to me. I lived through the crash of 2011. So I’ve seen it before. Easy come, easy go.

That’s my story. I’m pretty lucky overall. Even with the ALS, my life is very satisfying. But my life expectancy is limited. Those discussions about inheriting your bitcoins are of more than academic interest.

My bitcoins are stored in our safe deposit box, and my son and daughter are tech savvy. I think they’re safe enough. I’m comfortable with my legacy.
[edited slightly] “

Cypherpunk’s Manifesto

A Cypherpunk’s Manifesto

Eric Hughes

by Eric Hughes

” Privacy is necessary for an open society in the electronic age.

Privacy is not secrecy.

A private matter is something one doesn’t want the whole world to know, but a secret matter is something one doesn’t want anybody to know.

Privacy is the power to selectively reveal oneself to the world.

If two parties have some sort of dealings, then each has a memory of their interaction.

Each party can speak about their own memory of this; how could anyone prevent it?

One could pass laws against it, but the freedom of speech, even more than privacy, is fundamental to an open society; we seek not to restrict any speech at all.

If many parties speak together in the same forum, each can speak to all the others and aggregate together knowledge about individuals and other parties.

The power of electronic communications has enabled such group speech, and it will not go away merely because we might want it to.

Since we desire privacy, we must ensure that each party to a transaction have knowledge only of that which is directly necessary for that transaction.

Since any information can be spoken of, we must ensure that we reveal as little as possible.

In most cases personal identity is not salient. When I purchase a magazine at a store and hand cash to the clerk, there is no need to know who I am.

When I ask my electronic mail provider to send and receive messages, my provider need not know to whom I am speaking or what I am saying or what others are saying to me; my provider only need know how to get the message there and how much I owe them in fees.

When my identity is revealed by the underlying mechanism of the transaction, I have no privacy. I cannot here selectively reveal myself; I must always reveal myself.

Therefore, privacy in an open society requires anonymous transaction systems.

Until now, cash has been the primary such system.

An anonymous transaction system is not a secret transaction system.

An anonymous system empowers individuals to reveal their identity when desired and only when desired; this is the essence of privacy.

Privacy in an open society also requires cryptography.

If I say something, I want it heard only by those for whom I intend it.

If the content of my speech is available to the world, I have no privacy.

To encrypt is to indicate the desire for privacy, and to encrypt with weak cryptography is to indicate not too much desire for privacy.

Furthermore, to reveal one’s identity with assurance when the default is anonymity requires the cryptographic signature.

We cannot expect governments, corporations, or other large, faceless organizations to grant us privacy out of their beneficence.

It is to their advantage to speak of us, and we should expect that they will speak.

To try to prevent their speech is to fight against the realities of information.

Information does not just want to be free, it longs to be free.

Information expands to fill the available storage space.

Information is Rumor’s younger, stronger cousin;

Information is fleeter of foot, has more eyes, knows more, and understands less than Rumor.

We must defend our own privacy if we expect to have any.

We must come together and create systems which allow anonymous transactions to take place.

People have been defending their own privacy for centuries with whispers, darkness, envelopes, closed doors, secret handshakes, and couriers.

The technologies of the past did not allow for strong privacy, but electronic technologies do.

We the Cypherpunks are dedicated to building anonymous systems.

We are defending our privacy with cryptography, with anonymous mail forwarding systems, with digital signatures, and with electronic money.


Cypherpunks write code.


We know that someone has to write software to defend privacy, and since we can’t get privacy unless we all do, we’re going to write it.

We publish our code so that our fellow Cypherpunks may practice and play with it. Our code is free for all to use, worldwide.

We don’t much care if you don’t approve of the software we write.

We know that software can’t be destroyed and that a widely dispersed system can’t be shut down.

Cypherpunks deplore regulations on cryptography, for encryption is fundamentally a private act.

The act of encryption, in fact, removes information from the public realm.

Even laws against cryptography reach only so far as a nation’s border and the arm of its violence.

Cryptography will ineluctably spread over the whole globe, and with it the anonymous transactions systems that it makes possible.

For privacy to be widespread it must be part of a social contract.

People must come and together deploy these systems for the common good. Privacy only extends so far as the cooperation of one’s fellows in society.

We the Cypherpunks seek your questions and your concerns and hope we may engage you so that we do not deceive ourselves.

We will not, however, be moved out of our course because some may disagree with our goals.

The Cypherpunks are actively engaged in making the networks safer for privacy. Let us proceed together apace.

Onward.

Eric Hughes

 <hughes@soda.berkeley.edu>

9 March 1993


☆ Long Live the CypherPunks ☆


The world is in debt for your bright minds, even if it doesn’t know…

It’s minds like yours that always have changed the face of the earth for a better brighter future !

KUDOS TO YOU ALL !!!




Shared with 💚 by Free Spirit

✌ & 💚



BitHouse with 💚