Tuesday 16 February 2016

How does a hashing algorithm work?

  How does a hashing algorithm work?


Hashing algorithms are an important weapon in any cryptographers toolbox. They are everywhere on the internet, mostly used to secure passwords, but also make up an integral part of most crypto currencies such as Bitcoin and Litecoin.


The main features of a hashing algorithm are that they are a one way function – or in other words you can get the output from the input but you can’t get the input from the output – just like elliptic curve cryptography where you can’t get the private key from the public key. The other property is that the same input creates the same output.





Most hashing algorithms, including the SHA and RIPEMD are all descended from the MD4 family. The MD4 hashing algorithm was developed by Ronald Rivest specifically to allow very easy software implementation. The MD4 algorithm and subsequent SHA algorithms use 32 bit variables with bitwise Boolean functions such as the logical AND, OR and XOR operators to work through from the input to the output hash.


So how does a hashing algorithm work – in this case a look at SHA1:

1 – Create five variables
H0 - 01100111010001010010001100000001
H1 - 11101111110011011010101110001001
H2 - 10011000101110101101110011111110
H3 - 00010000001100100101010001110110
    H4 - 11000011110100101110000111110000
     
    2- Then choose a word to hash. In this case we will choose the word “CRYPTO”


    3- Convert the word to ASCII – “American Standard Code for Information Interchange”. Each letter has a number assigned to it.
    • CRYPTO – 67-82-89-80-84-79

    4- Convert ASCII code to binary –
    • CRYPTO – 01000011-01010010-01011001-01010000-01010100-01001111

     
    5- join characters and add 1 to the end.
    • CRYPTO – 0100001101010010010110010101000001010100010011111


    6- Add zeros to make the message equal to 448 mod 512 – (modular arithmetic just like a clock except with 512 hours). So a 48 bit message with the added one will need to have 399 zeros added to the end, and if the message was 64 characters (or 512 bits) long you would need 447 zeros.
    01000011010100100101100101010000010101000100111110­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­

     
     7- Add the original message length into the 64 bit field left over after the 448 modular arithmetic. The message is 48 characters long which expressed in binary is 110000. So the below is added to the end of the message in part six.

    • 0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­0­1­1­0­0­0­0­


    8- Break the message up into sixteen sections of 32 characters/bits.
    01000011010100100101100101010000
    010101000100111110­0­0­0­0­0­0­0­0­0­0­0000
    00000000000000000000000000000000
    00000000000000000000000000000000
    00000000000000000000000000000000
    00000000000000000000000000000000
    00000000000000000000000000000000
    00000000000000000000000000000000
    00000000000000000000000000000000
    00000000000000000000000000000000
    00000000000000000000000000000000
    00000000000000000000000000000000
    00000000000000000000000000000000
    00000000000000000000000000000000
    00000000000000000000000000000000
    00000000000000000000000000110000


    9- Transform the 16 x 32 character bit words into 80 words using a step loop function. First select four words for the first run through the loop which are strings 1,3,9 &14 from step 8.
    The next time through the loop we will use words 2,4,10,15 from stage 8.
    The next process is to XoR the words together. Xoring is just a basic computational function that gives the output of q only if the two inputs both have a 1 in that position – if they don’t the output is zero.

    The function is ((14 XOR 9) XOR 3) XOR 1) which is:
    00000000000000000000000000000000
    XOR
    01000011010100100101100101010000
    Is
    01000011010100100101100101010000
     
    10- perform a left rotate on the numbers – i.e. move the left most digit to the right.
    So
    01000011010100100101100101010000
    Becomes

    10000110101001001011001010100000

    This process is then repeated until there are 80 words, or strings of 32 bits.



    10- The next step is to run a set of functions over the words in a specific order operating off the five variables that were set in step 1. The functions combine AND, OR & NOT operators combined with left shifts.

    The end result is that you are left with five variables of:

    H0 – 01000100101010010111000100110011
    H1- 01010000111001010011100001011000
    H2-11110000010110000100011000111101
    H3-01001011111101111111000111100101
    H4-01000010110110011100101001001011


    11- Convert the H variables into hex:

    H0- 44a97133
    H1- 50e53858
    H2- f058463d
    H3 - 4bf7f1e5
    H4 - 42d9ca4b


    12- Join the variables together to give the hash digest:

    44a9713350e53858f058463d4bf7f1e542d9ca4b
     
    This is the basic process behind hashing – simply convert a number into binary then perform a set of simple functions that operate through basic standard transistor and bus processes such as AND, XOR, NOT, Rotate &OR. This is part of the reason that ASIC, or application specific chips can be designed that optimise hashing. In the case of SHA-256 chips have been specifically designed to optimise the iterations throughout the steps to increase the speed of creating a hash from an input. In the case of mining this means you can calculate more hashes per second by iterating through the nonce and extra nonce parameters and have a higher probability of winning the block reward.



    RELATED ARTICLES:

    What is the Bitcoin Transactions?
    source: http://theriseofthebitcoins.blogspot.com/2016/02/what-is-bitcoin-transaction.html

    How does the bitcoin network actually work?
    source: http://theriseofthebitcoins.blogspot.com/2016/02/how-does-bitcoin-network-actually-work.html

    Bitcoin Transactions – The Scriptsig and Scriptpubkey source: http://theriseofthebitcoins.blogspot.com/2016/02/bitcoin-transactions-scriptsig-and.html

    What are the Bitcoin Transaction types?source: http://theriseofthebitcoins.blogspot.com/2016/02/what-is-bitcoins.html


    What is Bitcoins?

    What is Bitcoin?


    Bitcoin is a payment system introduced as open-source software in 2009 by developer Satoshi Nakamoto. The payments in the system are recorded in a public ledger using its own unit of account, which is also called bitcoin. Payments work peer-to-peer without a central repository or single administrator, which has led the US Treasury to call bitcoin a decentralized virtual currency. Although its status as a currency is disputed, media reports often refer to bitcoin as a cryptocurrency or digital currency.

    Bitcoin and Crypto Currencies are digital forms of electronic money. They are different to the traditional fiat money system in three key ways: transactions are anonymous, you can create your own wallet bank account in minutes and the network is decentralised run through consensus of its participants.
     
    If you want to know more then check out the full Bitcoin News & Articles

     Digitaly Encrypted Currency
    Bitcoins are created as a reward for payment processing work in which users offer their computing power to verify and record payments into the public ledger.


    Called mining, individuals or companies engage in this activity in exchange for transaction fees and newly created bitcoins.


    Besides mining, bitcoins can be obtained in exchange for fiat money, products, and services.
    Users can send and receive bitcoins electronically for an optional transaction fee using wallet software on a personal computer, mobile device, or a web application.

    Bitcoin as a form of payment for products and services has seen growth,and merchants have an incentive to accept the digital currency because fees are lower than the 2-3% typically imposed by credit card processors. The European Banking Authority has warned that bitcoin lacks consumer protections. Unlike credit cards, any fees are paid by the purchaser not the vendor. Bitcoins can be stolen and chargebacks are impossible. Commercial use of bitcoin is currently small compared to its use by speculators, which has fueled price volatility.

    Bitcoin has been a subject of scrutiny amid concerns that it can be used for illegal activities. In October 2013 the US FBI shut down the Silk Road online black market and seized 144,000 bitcoins worth US$28.5 million at the time. The US is considered bitcoin-friendly compared to other governments.

    "In China, buying bitcoins with yuan is subject to restrictions, and bitcoin exchanges are not allowed to hold bank accounts."

    Bitcoin and other crypto currencies are also anonymous – you can set up a wallet in minutes and start receiving or giving Bitcoin via your personal address number. Any transaction you do make shows up on the blockchain- the central ledger of all transactions ever made! So you are anonymous in one sense but if anyone knows what your address is then they can discover your entire transaction history. 

    Bitcoin itself is designed to lower the amount of bitcoins produced every ten minutes – after mining a block – by 50% every four years. In other crypto currencies the reward for mining each block is kept constant or can vary in whichever way the developer decides. Unlike governments who can print cash to encourage inflation, or devalue their currency or debt, Bitcoin is not subject to these external forces. 



    Bitcoin was created by Satoshi Nakomoto in 2009 to produce a currency that wasn’t controlled by any Government. Bitcoin, and all other crypto currencies, are run by its users and miners and print new money through mining by validating the transactions in a specific period of time. The rate of new money being printed is designed in the DNA of the crypto currency, and with Bitcoin there is a hard cap of 21 million Bitcoins ever to be produced which are then divisible into satoshi, or 100,000,000th of one Bitcoin.




    Governments and regulators don’t necessarily like Bitcoin – especially in emerging markets – where the onus is on stopping money from leaving the country and keeping it for internal investment. In Western more developed Governments there are fears due to its anonymity not complying with money laundering procedures and potentially providing a means for illegal activities such as terrorism or the drug trade. That said, the more liberal western governments see Bitcoin and crypto currencies as an innovative technology that could provide a means for furthering trade, increasing competition in the banking industry, and more.

    thanks for reading!

    RELATED ARTICLES:







    What are the Bitcoin Transaction types?


    What are the Bitcoin Transaction types?

    There are six standard Bitcoin transaction types at the time of writing. The developers behind Bitcoin have been continuously evolving the types of transactions to allow more functionality – the present list may change in the future. There are five standard transactions which are accepted by the standard client – although some miners will accept a non standard transaction for a price. 

    The most popular type of transaction is the TX_PUBKEY, or pay to public key transaction – with over 99% of total transaction volume as of 2014.


    The % share of this is expected to change as the Bitcoin community introduces wallets and other ancillary services that use the functionality of different transaction types. 

    The problem with more complex transaction times is that they occupy more space in the blockchain which leads to issues with the blocksize. A topic that has come to the fore in 2015 as developers and economists try to find a balance between immediacy of transaction confirmation and miners wanting to restrict supply of space. 


    For further examples on how a transaction is validated by a node check out our guide on each transaction type and the most common transaction type of Pay-to-Address. 


    Bitcoin Transactions – Pay-to-Script-Hash?


    Bitcoin Transactions – Pay-to-Script-Hash?


    Pay-to-Script-hash, or P2SH, are extension of the multisignature idea but reducing the burden on the Bitcoin infrastructure in terms of storage required. 

    A common 2-of-3 multisignature transaction can take up to five times as much space as a simple pay to address or pay to public key transaction.


    They also reduce the complexity of the encoding, and shift the burden in terms of fees from the sender to the recipient – after all it’s their request to have the complexity in the conditions for the release of the funds. 


     
    This is done by transferring the script used to spend the transactions to the and making the hold a hash of the script. This means that a new address has been created – a script address.



    Script addresses are not made through the usual process of elliptic curve cryptography but are instead the hash of the of a multi signature transaction. A script address is appended with a value of five before being hashed, resulting in hashed script addresses starting with the number 3 – remember that standard Bitcoin addresses start with a 1 – with other variances for the testnet. 

    Structuring P2SH transactions should be done with care as an error can make the transaction unspendable. Another important point is that the details of the transaction script are not stored in the blockchain, only the hash, and therefore the creator of the transaction must keep a copy of the script or remember the route to generate the specific hash. 



    RELATED ARTICLES:

    What is the Bitcoin Transactions?
    source: http://theriseofthebitcoins.blogspot.com/2016/02/what-is-bitcoin-transaction.html

    How does the bitcoin network actually work?
    source: http://theriseofthebitcoins.blogspot.com/2016/02/how-does-bitcoin-network-actually-work.html

    Bitcoin Transactions – The Scriptsig and Scriptpubkey




    Bitcoin Transactions – The Scriptsig and Scriptpubkey


    The Scriptsig and Scriptpubkey – locking and unlocking a transaction?


    The Scriptpubkey is the puzzle set to a transaction in order for it to be solved and the script sig is the solution to the puzzle that allows it to be spent.

    Historically the Scriptpubkey was named so as it contained the public key or address to be spent from – i.e. the address the transaction was locked to. The scriptsig was called so due to its need to contain the signature – i.e. the private key of the address that wants to spend and to which the address in the scriptpubkey was locked to. 

    The Bitcoin transaction script language is a stack based execution language – to layman this is a very basic form of language that doesn’t contain loops and is Turing incomplete (i.e. can’t with an unlimited amount of memory, processing power and time solve everything) – it is designed for one purpose. The stack based execution language has a few important benefits such as its simplicity and minimal processing. 


    The script language processes from left to right. Numbers are pushed onto the stack and then operated acted on by the next function. There are conditional operators which give the result true or false which in the case of validating a transaction are true if the signature is valid.

     
     The above example is the process of a simple pay to public key hash transaction. 


    The above transaction shows the stack based operating procedure for resolving the transaction
    – i.e. unlocking it and spending it. To see the process in more detail see our different types of bitcoin transactions and the P2PKH – pay to public key hash transaction type


    RELATED ARTICLES:

    What is the Bitcoin Transactions?
    source: http://theriseofthebitcoins.blogspot.com/2016/02/what-is-bitcoin-transaction.html

    How does the bitcoin network actually work?
    source: http://theriseofthebitcoins.blogspot.com/2016/02/how-does-bitcoin-network-actually-work.html





    How does the Bitcoin Network actually work?

    The Bitcoin network is a peer to peer network (P2P) or a decentralised network with no central point of failure or command. All the nodes, or computers, that participate in the network are equal – there is no hierarchy – or no topology as the network is flat. 

    The Bitcoin network is a collection of nodes running the Bitcoin P2P protocol with other protocols such as stratum, used for lightweight mobile wallets (where the full block chain is not downloaded) or for mining. 

    Although the network is flat, and all nodes are equal, some nodes or computers perform a different task.  

    A full node does routing, holds a full copy of the blockchain database, performs mining and provides wallet services. Any node has to provide the routing function to participate in the network. Routing is just another way of saying that the node validates and passes on transactions and block as well as discovering and maintaining connections to other nodes, whether they are full nodes or not. 

    Some nodes don’t hold a full copy of the blockchain and verify transactions by using the Simplified Payment Verification, or SPV

    Mining nodes, that run specialised application specific integrated chips to solve the proof of work algorithm. Some of the mining nodes are full nodes whilst others are lightweight participating in pool mining and using a pool server to maintain a full node. 

    Wallets can be a full node – as is the case with downloading the full bitcoin client onto your desktop. Mobile wallets however can’t hold the entire blockchain through space requirements and are essentially simplified payment verification nodes or lightweight nodes

    Apart from these main classifications there are other servers and nodes running other protocols - such as alternative wallets and specialised mining pools. The main Bitcoin network contains about 7000-10000 nodes at a time! 

    When joining the network for the first time a new node must discover at least one other existing node – geographical location takes no precedence in this procedure. The new node sends a series of messages and then if the other node wishes to form a connection it replies. 

    The new node must form new connections to the network, as sometimes some nodes go offline from time to time as people switch their computers off. Then the new node is meshed into the network and resilience is created. 

    If you want to run a full node you’re now in for a bit of a wait - all the transactions since Bitcoins genesis in 2009 need to be downloaded. This is done by requesting other nodes to send all their information over to you, and so as not to overload them, this can be done in conjunction with other nodes. 

    But the good news is if you want your own wallet on your phone and don’t want, or need to run the Bitcoin full client, you can simply just use Coinbase’s or blockchain.io’s simplified version and set it up in seconds. 



    Transaction malleability is a loophole in the bitcoin protocol that was most famously used in February 2014 to allegedly withdraw funds from Mt Gox 
    The idea behind transaction malleability is that a user who is tracking transactions via their hash would not be able to trace the transaction if the hash was changed. read more here.

    for more related articles, visit here. Thanks for reading, hope you like it ! Share !






     

    What is Bitcoin Transaction malleability – MT GOX?

    What is Bitcoin Transaction malleability – MT GOX?





    Transaction malleability is a loophole in the bitcoin protocol that was most famously used in February 2014 to allegedly withdraw funds from Mt Gox

    The idea behind transaction malleability is that a user who is tracking transactions via their hash would not be able to trace the transaction if the hash was changed. 

    The risk could have been easily mitigated through simplistic internal checks and balances.



    A transaction is in the blockchain is referred to by its hash, and their value is included in the merkle tree for that block. A transaction is also signed by the private key associated with the transaction input. So if the transaction can be altered before being hashed and signed with the signature and then propagated to the network – the sender would not be able to track the transaction as its hash has been altered. 

    The attackers using transaction malleability against Mt Gox would request a withdrawal. When they received a hash of the transaction from the Company they would alter it by changing the whilst using the and re-flooding the network with this new transaction. Mt Gox would then look for their transaction and assume there was an issue and resubmit the funds to the user.

    The user could then repeat this attack. Their flaw was that if they didn’t manage to propagate their updated transaction quick enough then they would still receive the Bitcoin but wouldn’t receive the extra funds. In this case they just tried again – they hadn’t lost much – just a bit of time. 

    This meant that Mt Gox’s funds were gradually leached away. However basic accounting checks and reports would have been able to detect this breach or loophole. In fact when summing up the process this was due to a lack of oversight by the management. 



    HOW does the bitcoin network actually work ?

    The Bitcoin network is a peer to peer network (P2P) or a decentralised network with no central point of failure or command. All the nodes, or computers, that participate in the network are equal – there is no hierarchy – or no topology as the network is flat.  read more here.




    thanks for reading ! hope you like it !
     

    Wednesday 10 February 2016

    Help grow the bitcoin community and earn free bitcoin.


    Help grow the bitcoin community and earn free bitcoin.


    Coinbase Expands to Canada

    We’re pleased to announce the expansion of Coinbase services to Canada. As of today, our customers in Canada can buy and sell bitcoin with CAD using our Buy/Sell service, as well as trade the BTC/CAD currency pair on Coinbase Exchange.

    As part of our effort to make bitcoin easy to use throughout the world, customers in Canada can now:
    • Buy and sell bitcoin with a Canadian bank account (via EFT direct debit)
    • Deposit CAD to a Coinbase wallet to buy bitcoin or trade on Coinbase Exchange 
      (via EFT direct debit or Interac Online)
    • Trade BTC/CAD on Coinbase Exchange
    • Use our suite of Coinbase wallet services, including hosted bitcoin wallets

    To celebrate the launch, Coinbase will waive its retail conversion fees for Canadian customers of the direct Buy/Sell service, available at Coinbase.com, through September 6 (11:59 Pacific time). Standard trading fees on Coinbase Exchange apply. To get started, simply sign up for a Coinbase Wallet or Coinbase Exchange account. You can learn more about funding your account here.

    In conjunction with our Canadian expansion, we’re delighted to be sponsoring the Hack the North hackathon at the University of Waterloo. Coinbase will award the group that makes best use of our API with a $1,000 bitcoin prize and guaranteed interviews for an engineering internship.

    Coinbase buy/sell functionality is now available in 27 countries worldwide. As always, please be sure to let us know what you think on Twitter and in our Community Forum.


    JOIN NOW!

    INVITE FRIENDS AND GET FREE BITCOIN

    Invite friends to Coinbase, and received 100 bits in rewards!
    Using bitcoin is more fun with friends!

    You can invite your friends by sharing the provided link. Once your friend buys $100 of bitcoin or more, you will both get $10 of free bitcoin.

    Invite a friend who buys $100 of bitcoin or more, and you'll both earn $10 of free bitcoin!

    Updating...

    What is Bitcoin?

    Bitcoin is digital money used for secure and instant transfer of value anywhere in the world. It is not controlled or issued by any bank or government - instead it is an open network which is managed by its users. Much in the way email improved communication by making it fast and cheap, bitcoin is an improvement on existing payment methods which were not designed for the internet eraread more here.


    Litecoin founder Charles Lee

    Charles Lee isn’t nearly as invisible as Satoshi Nakamoto, but he’s doing his best. The creator of Litecoin, the second most successful cryptocurrency after Bitcoin, was happy to speak with CoinDesk, but he didn’t want to reveal too much about himself. What we know for sure about the California-based software engineer is that he graduated from a leading technology-focused university in 1999, and is currently working for an Internet software company. CoinDesk knows who that is – and the odd reference can be found online by those who know where to look - but Lee really doesn’t like to talk about it. 

    The six-person team behind the altcoin is equally secretive. “They are people that I talked to over the years on IRC and other forums,” Lee says of the team, which communicates with the broader community through chat rooms and message boards. “Some of them don't want their identities known.”



     
    “People are always afraid of government intervention,” he says. “Cryptocurrency is such a powerful concept that it can almost overturn governments.”


    Lee heard about Bitcoin two years ago, and almost immediately understood the significance of the idea. “I definitely think that what the Internet did to information, cryptocurrency will do to currency,” he says. Like many digital coin enthusiasts, he started mining bitcoin before getting into the altcoin scene. 
    read more here.






    What is Litecoin?



    What is Litecoin?

    Litecoin is a peer-to-peer Internet currency that enables instant, near-zero cost payments to anyone in the world. Litecoin is an open source, global payment network that is fully decentralized without any central authorities. Mathematics secures the network and empowers individuals to control their own finances. Litecoin features faster transaction confirmation times and improved storage efficiency than the leading math-based currency. With substantial industry support, trade volume and liquidity, Litecoin is a proven medium of commerce complementary to Bitcoin.


    Open Source Software

    Litecoin is an open source software project released under the MIT/X11 license which gives you the power to run, modify, and copy the software and to distribute, at your option, modified copies of the software. The software is released in a transparent process that allows for independent verification of binaries and their corresponding source code.

    Please Share, If you think this was helpful.


    Related Articles: How to get started with Litecoin?


    Download the list of software here.

    Litecoin Core v0.10.4.0 released!
    This is an important update, all users, especially miners are advised to upgrade.




    DOWNLOAD LITECOIN CORE FOR WINDOWS




    DOWNLOAD LITECOIN CORE FOR GNU/LINUX 




    DOWNLOAD LITECOIN CORE FOR MAC OS X 




    DOWNLOAD LITECOIN FOR ANDROID & BLACKBERRY 


     

    ELECTRUM LITECOIN 




    LITECOIN CORE GITHUB
     ANDROID GITHUB








    Like & Share