PHP Classes

PHP Secure Chat: Chat box between users using encrypted messages

Recommend this page to a friend!
  Info   View files Example   View files View files (10)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 49%Total: 1,198 This week: 1All time: 3,158 This week: 70Up
Version License PHP version Categories
cchat 2.3GNU General Publi...5PHP 5, Cryptography


This package implements chat box between users using encrypted messages.

It can output HTML and JavaScript to implement a chat box between users.

They use a commonly agreed password to encrypt the messages using BlowFish before they are sent to the server via AJAX.

The server stores the encrypted messages in a MySQL database before they are delivered and decrypted to other chat users with the same password.

Innovation Award
PHP Programming Innovation award nominee
January 2017
Number 12

Prize: One ebook of choice by Packt
When you want to implement a chat system between users of your application or site, there is always the concern that the messages may be viewed by people that manage the site, or even by spies and secret services because messages may have to be stored in the server before delivering them to the other users in the chat.

One way to avoid this problem is to implement end to end cryptography. This means that messages are encrypted before sent from the origin user and only decrypted by the destination users.

This package provides a solution to implement such approach in PHP. It uses some JavaScript to encrypt messages before sending from the origin user browser using the Blowfish algorithm.

It uses a secret key that only the origin and destination users know about. This way messages may be securely stored on the server database to be able to deliver to the recipient later when he is not online, without the risk of a third party viewing the messages without knowing the secret password.

Manuel Lemos
Picture of Martin Latter
  Performance   Level  
Name: Martin Latter <contact>
Classes: 8 packages by
Country: United Kingdom
Age: ???
All time rank: 130660 in United Kingdom
Week rank: 82 Up3 in United Kingdom Up
Innovation award
Innovation award
Nominee: 5x






?><!DOCTYPE html>

<html lang="en">

        <meta charset="iso-8859-1">
        <meta name="description" content="CChat ~ Cryptochat">
        <meta name="author" content="Martin Latter">
        <meta name="copyright" content="&copy; 2010-<?php echo date('Y'); ?> Martin Latter">
        <link type="text/css" href="css/cchat.css" rel="stylesheet" media="all">
        <script src="js/cchat.js"></script>
        <script src="js/bf.js"></script>


        <div id="chatboxcontainer">

                <p>Browser JavaScript must be enabled for CChat to operate.</p>

            <div id="title">CryptoChat</div>
            <div id="chatbox" class="curved">

echo Chatbox::outputMessages();


            <div id="chatboxinput">
                <input type="text" id="name" name="name" maxlength="15" placeholder="name" class="curved">
                <input type="password" id="pw" maxlength="30" placeholder="password" class="curved">
                <textarea id="message" name="message" maxlength="255" cols="26" rows="7" placeholder="message" class="curved"></textarea>
                <div id="remcharcontainer"><span id="remchar">255</span> chars remaining</div>
                    <input type="button" id="chatsubmit" value="chat" class="curved">
                    <input type="button" id="decrypt" value="decrypt" class="curved">
                <div id="error"></div>

            <div id="debug"></div>




  Files folder image Files  
File Role Description
Files folder imageclasses (1 file)
Files folder imagecss (1 file)
Files folder imageincludes (2 files)
Files folder imagejs (2 files)
Files folder imagesql (1 file)
Accessible without login Plain text file index.php Example Example script
Accessible without login Plain text file install.php Example Example script
Accessible without login Plain text file Doc. Documentation

  Files folder image Files  /  classes  
File Role Description
  Plain text file cchat.class.php Class Class source

  Files folder image Files  /  css  
File Role Description
  Accessible without login Plain text file cchat.css Data Auxiliary data

  Files folder image Files  /  includes  
File Role Description
  Accessible without login Plain text file check.php Example Example script
  Accessible without login Plain text file update.php Example Example script

  Files folder image Files  /  js  
File Role Description
  Accessible without login Plain text file bf.js Data Auxiliary data
  Accessible without login Plain text file cchat.js Data Auxiliary data

  Files folder image Files  /  sql  
File Role Description
  Accessible without login Plain text file cchat.sql Data Auxiliary data

 Version Control Unique User Downloads Download Rankings  
This week:1
All time:3,158
This week:70Up
 User Ratings  
 All time