When a coupon code is generated, it is typically based on an algorithm that takes into account data such as the store's name and product cycles. However, this does not mean that they are immune to hacking. In fact, there have been numerous cases where coupon codes have been leaked online or even stolen in order to exploit customers who may be unaware of the deal.