In this study, it is shown how the equivalent sand roughness required in the Moody chart can be calculated for arbitrarily shaped wall roughnesses. After a discussion of how to define the wall location and roughness height in the most reasonable way, a numerical approach based on the determination of entropy production in rough pipes and channels is presented. As test cases, three different two-dimensional roughness types have been chosen which are representative of regular roughnesses on machined surfaces. In the turbulent range, skin friction results with these test roughnesses can be linked to Nikuradse's sand roughness results by a constant factor. For laminar flows, a significant effect of wall roughness is identified which in most other studies is neglected completely. The dissipation model of this study is validated with experimental data for laminar and turbulent flows.