Side-Channel Analysis of Embedded Systems : An Efficient Algorithmic Approach