Crypto Zombies Lesson 1 ,Ch11 Keccak256 and Typecasting, Solidity Programming

Lesson Summary

In chapter 11 of Crypto Zombies we are looking at the Keccak256 hash function. A hash function maps a string into a pretty random 256-bit hexidecimal number. This will allow us to create our zombie DNA. In this challenge we take our _str variable and throw it into the Keccak256 function and store it in a variable named rand. We make sure to typecast the _str to a uint. Once we do that and have the result stored in rand we then return rand % dnaModulus. Typecasting allows us to convert between datatypes since strings sometimes store numbers we might want to do math with those numbers later and would have to convert our string to an number to be able to do math with it.

Subscribe To Monthly Newsletter. Chance to Win Monthly Prizes

* indicates required