Security is one of the biggest issues for data communication through wired networks as well as wireless networks.The past work were different on the designs of cryptography algorithms and system infrastructures, we will propose a dynamic routing algorithm that could randomize delivery paths for data transmission.The Algorithm is easy to use and easily suits with popular routing protocols, such as (RIP) Routing Information Protocol which is in wired networks and (D-SDV) Destination-Sequenced Destination vector protocols which is in wireless networks. An analytic study based on the proposed algorithm which is presented, and there is a range of simulation of tests which are done in order to analyze the various outputs and the capability of this algorithm.