The document presents a secure data distribution algorithm for fog computing that enhances data confidentiality and integrity in cloud storage through a three-layer architecture involving cloud, fog, and local servers. By combining Advanced Encryption Standard (AES) and Reed-Solomon coding, the proposed system mitigates risks associated with data breaches by ensuring that even if one server is compromised, the attacker cannot access all data. The paper also details the implementation and performance evaluation of this algorithm to assess its effectiveness and efficiency against various attack vectors.