107
Page | 1 COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETIC Done at Department of Computer Applications Submitted by Hemant Kumar Reg.No. 95580016 In partial fulfillment for the award of the degree of MASTER OF COMPUTER APPLICATIONS APRIL 2011 DEPARTMENT OF COMPUTER APPLICATIONS COCHIN UNIVERSITY OF SCIENCE AND TECHNOLOGY COCHIN-682022

COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

  • Upload
    lecong

  • View
    250

  • Download
    4

Embed Size (px)

Citation preview

Page 1: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 1

COMPUTER ARITHMETIC OPERATION USING

MODULAR ARITHMETIC

Done at

Department of Computer Applications Submitted by Hemant Kumar Reg.No. 95580016 In partial fulfillment for the award of the degree of

MASTER OF COMPUTER APPLICATIONS

APRIL 2011

DEPARTMENT OF COMPUTER APPLICATIONS

COCHIN UNIVERSITY OF SCIENCE AND TECHNOLOGY

COCHIN-682022

Page 2: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 2

COCHIN UNIVERSITY OF SCIENCE AND TECHNOLOGY

COCHIN-682022

CERTIFICATE

This is to certify that the project report entitled “COMPUTER

ARITHMETIC OPERATION USING MODULAR ARITHMETIC " is a

bonafide record of the project work done by HEMANT KUMAR (Reg

No.95580016) under my supervision and guidance.

It is partial fulfillment of requirement for the award of the degree of

MASTER OF COMPUTER APPLICATIONS in Department Of Computer

Applications of COCHIN UNIVERSITY OF SCIENCE AND

TECHONOLOGY,COCHIN.

________________ __________________ Faculty Guide Head of the Department ___________________ ___________________ Internal Examiner External Examiner

Submitted on :_______________

Page 3: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 3

DECLARATION

‘I hereby declare that the project work is submitted in partial fulfillment of the

requirements for the award of the degree of Master of Computer Applications and it is

a report of the original work done by me during the period of January – April in

Department of computer applications, Cochin University of Science and Technology,

Cochin.’

HEMANT KUMAR Place: Cochin Date:

Page 4: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 4

CONTENTS

• ACKNOWLEDGEMENT

• SYNOPSIS

1. INTRODUCTION

1.1 ORGANISATION PROFILE

1.1 PROJECT PROFILE

1.2 SYSTEM ENVIRONMENT

2 SYSTEM ANALYSIS

2.1 SYSTEM STUDY

2.2 FEASIBILITY STUDY

3 SOFTWARE REQUIREMENTS SPECIFICATION

3.1 USER CHARACTERISTICS

3.2 REQUIREMENT SPECIFICATION

3.3 FUNCTIONAL REQUIREMENTS

3.4 NON-FUNCTIONAL REQUIREMENTS

3.5 CONSTRAINTS

3.6 SPECIFIC REQUIREMENT

4 CHALLENGE IN THIS FIELD

4.1 FAST CALCULATION

4.2 SELECTION OF ALGORITHM

5 APPROACH IN THIS DIRECTION

5.1 CALCULATE SEVSRAL MODULE

5.2 CALCULATE MODULUS 5.2 CALCULATE DIFFERENT MODULAR OPERATION

6 SOFTWARE QUALITY ASSURANCE PLAN

6.1 PURPOSE

6.2 SCOPE

6.3 OVERVIEW OF THE DOCUMENT

Page 5: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 5

6.4 TASKS AND RESPONSIBILITIES

6.5 SQA IMPLEMENTATION IN DIFFERENT PHASES

6.6 DOCUMENTATION

6.7 SOFTWARE DOCUMENTATION AUDIT

6.8 REQUIREMENTS TRACEABILITY

6.9 SOFTWARE DEVELOPMENT PROCESS

4.10 PROJECT REVIEW

4.11 TESTING AND QUALITY CHECK

7 SYSTEM DESIGN

7.1 ARCHITECTURAL DESIGN

7.2 PROCESS DESIGN

8 DATA DESIGN

8.1 DATA FLOW DIAGRAMS

8.2 HEADER FILES

8.3 USE CASE DIAGRAM

8.4 SEQUENCE DIAGRAM

8.5 CLASS DIAGRAM

9 SYSTEM TESTING

9.1 INTRODUCTION

9.2 LEVELS OF TESTING AND TEST CASES

9.3 VALIDATION CHECKS

10 SYSTEM IMPLEMENTATION

11 SYSTEM MAINTENANCE

12 CONCLUSION

13 SREEC SHOTS

• BIBILIOGRAPHY

Page 6: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 6

ACKNOWLEDGEMENT

Completing a task is never a one-man effort. It offers the result of valuable

contribution of a number of individuals in a direct or indirect manner that helps in shaping

and achieving an objective.

This project would not have taken shape, but for

the guidance provided by Dr. A. Sreekumar, faculty member of DCA CUSAT,

Dr. B. Kannan, faculty member of DCA CUSAT and .Mrs. Malathi ,faculty

member of DCA CUSAT has helped me so much.

I express my profound gratitude to Dr.K.V.Pramod , Head of the Department

and all staff members of the Department of Computer Applications for their endless help

and support.

The guidance and support received from all the members who contributed and

who are contributing to this project, was vital for the success of the project. I am grateful

for their constant support and help.

I wish to express my heartfelt gratitude to my family, who has always been the

singular source of inspiration in all my ventures I have undertaken. Also I thank all my

friends for their help and suggestions.

Above all I thank the Almighty for His blessings and providing mercies at all

stages of my work.

HEMANT KUMAR

Page 7: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 7

SYNOPSIS

Implementation of for ‘Computer Arithmetic Operations using

modular Arithmetic’ is a real time, customizable Algorithmic implementations

which is easily portable, adaptable and customizable to multiple hardware &

software and have less Time and Space Complexity.

It uses recursive approach that uses various

number theory algorithm to perform basic operation. A modular approach perform

uses computer word size for its operation,restrict the overflow condition and

perform fastly.

Implementation of this algorithm is performed can be used in various

field ie

• Public key cryptography

• Network security algorithm

• Checking performance of various number theory/cryptography

algorithm

This implementation includes following operations on large digit

operation

• Addition

• Subtraction

• Multiplication

• Division

• Modulus

• Power.

Page 8: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 8

INTRODUCTION

1.1 ORGANIZATION PROFILE

Cochin University of Science & Technology (CUSAT) is a government owned

autonomous university in Kochi (Cochin), Kerala, India. Founded in 1971, the

university consists of three campuses, two in Kochi and one in Kuttanad, Alappuzha,

about 66 km inland. The university awards degrees in various fields of engineering and

allied subjects at the undergraduate, postgraduate and doctoral levels. Nearly 2,000

students engage yearly in various areas of undergraduate and postgraduate study in this

university. The institute was poised to become Indian Institute of Engineering, Science

and Technology, Kochi (IIEST Kochi), but the proposal was rejected by the state

government in a surprising turn of events.

Originally known as University of Cochin, the University

came into being in 1971 through an Act of the Legislature of Government of Kerala

that was the result of a concerted campaign for postgraduate education in the State of

Kerala. The university was reorganized into Cochin University of Science and

Technology (CUSAT) in February 1986. The process of reorientation resulted in

redefining the objectives as the promotion of undergraduate and postgraduate studies

and advanced research in applied science, technology, industry, commerce,

management and social sciences . Admissions are based on an All India Entrance

Examination known as Common Admission Test (CAT) conducted by the University

which includes different papers for admissions to various undergraduate and

postgraduate courses. Various Departmental Admission Tests (DAT) are also

conducted for some postgraduate Courses.

Department of Computer Applications

Computer Applications is one of the thrust areas in science and

technology. In appreciation of its growing importance in business and visualising the

career prospects, the University established the Department of Computer Applications

to facilitate research and human resource development in the subject. The M.C.A.

programme was started (1994) with a model curriculum prepared jointly by ISTE and

the Department of Electronics with minor modifications. The Syllabus is updated

Page 9: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 9

periodically, based on the current trends and requirements of the industry. The

Department has a proud alumni, most of them being placed in much reputed

international firms like IBM, WIPRO, INFOSYS, TCS, CTS etc. The Research

activities of the Department include the subject areas Fuzzy sets and Logic

Applications in Artificial Intelligence, Simulation, Cryptography & Coding Theory,

Algorithm, Pattern recognition, Internet-Marketing, E-commerce and Internet

Technology, Networking and Mobile Communication and Software Engineering. Apart

from this, the Department has taken up a challenging research project funded by

AICTE, Computer Assisted Classical Music. The Department of Computer

Applications is also doing consultancy work for public and private sector undertakings.

The Department has an excellent library with more than 3000 books and various

national and international journals. The Department has a well-equipped laboratory,

which is being constantly updated with the latest computers.

1.2 PROJECT PROFILE

‘Modular Arithmetic’ is an interesting alternative for doing arithmetic

on Large Integer numbers, based on some simple principle of number theory.

Previously all classical algorithm used for computer arithmetic for Large number

take O(n2) time for multiplication and another operation based on it but by using

Modular Arithmetic we may do all operation in O(n) or O(log n) time.

The idea is to have several modulus m1,m2

………mr that contains no common factors and to work indirectly with residues

with u mod m1, u mod m2, …………. u mod mr instead of directly with number u.

Let

U1 = u mod m1

U2 = u mod m2

……………..

Page 10: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 10

……………..

Ur = u mod mr

It is easy to compute (u1,u2,…,ur) by using some algorithm then

by applying Chinese remainder theorem we find desired result. The advantage of

modular arithmetic are addition, subtraction and multiplication are very simple. By

using these three operation we perform division, modulus, power and other

arithmetic operation. All these operation are done by using shifting and other basic

arithmetic operation defined by operating system on basic data types.

1.3 SYSTEM ENVIRONMENT

� HARDWARE REQUIREMENTS

Processor : Intel Pentium IV

Main Memory : 512 MB RAM

Hard Disk : 80 GB

CD Drive : 52X speed

Mouse : Standard two button or higher

Keyboard : Standard 101-102 key keyboard

Display : 15” Monitor

Other devices : Modem

� SOFTWARE REQUIREMENTS

Page 11: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 11

Operating System : Windows 2000/XP/Linux

Language Used : c++

� DEVELOPMENT TOOLS

Software : vc++(For xp)

� THEORITICAL FRAMEWORK

� WINDOWS XP OPERATING SYSTEM

The operating system used was Microsoft Windows XP. The

Windows XP provides a suitable environment for the smooth functioning of the

project.

Windows XP makes personal computing easy. Power, performance,

a bright new look and plenty of help when you need it. Windows XP has it all,

along with unmatched dependability and security.

Windows XP professional marks a new standard in business

software combining enterprise-class performance and reliability with

unprecedented ease of use. Built on the rock-solid foundation of Microsoft’s

proven Windows 2000 technology, Windows XP Professional contains all the

features of Microsoft Windows XP Home Edition, and includes new and enhanced

features designed especially for business and advanced use.

The all-new Help and Support Center in Windows XP is our one-stop shop for:

• Clear how-to instructions

• Engaging start-to-finish articles

Page 12: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 12

• Troubleshooting advice.

Special wizards give you step-by-step instructions to smooth the

way when connecting new devices and running new software.

� HISTORY OF LINUX

Linux is a true 32-bit operating system that runs on a variety of different platforms,

including Intel, Sparc, Alpha, and Power-PC (on some of these platforms, such as

Alpha, Linux is actually 64-bit).

Linux was first developed back in the early 1990s, by a young Finnish then-university

student named Linus Torvalds.

Eventually he announced his little project in the USENET group comp.os.minix, asking

for interested parties to take a look and perhaps contribute to the project. The results

have been phenomenal!

The interesting thing about Linux is, it is completely free! Linus decided to adopt the

GNU Copy left license of the Free Software Foundation, which means that the code is

protected by a copyright -- but protected in that it must always be available to others.

Free means free -- you can get it for free, use it for free, and you are even free to sell it

for a profit . The great thing is, you have access to source code which means you can

customize the operating systems to your own needs, not those of the "target market" of

most commercial vendors.

Linux can and should be considered a full-blown implementation of unix. However, it

can not be called "Unix"; not because of incompatibilities or lack of functionality, but

because the word "Unix" is a registered trademark owned by AT&T, and the use of the

word is only allowable by license agreement.

Linux is every bit as supported, as reliable, and as viable as any other operating system

solution (well, in my opinion, quite a bit more so!).

Page 13: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 13

� HISTORY OF c++

The C++ programming language provides a model of memory and computation that

closely matches that of most computers. In addition, it provides powerful and flexible

mechanisms for abstraction; that is, language constructs that allow the programmer to

introduce and use new types of objects that match the concepts of an application. Thus,

C++ supports styles of programming that rely on fairly direct manipulation of hardware

resources to deliver a high degree of efficiency plus higher-level styles of programming

that rely on user-defined types to provide a model of data and computation that is closer

to a human’s view of the task being performed by a computer. These higher-level styles

of programming are often called data abstraction, object-oriented programming, and

generic programming.

2 The Design and Evolution of C++

C++ was designed and implemented by Bjarne Stroustrup (the author of this article) at

AT&T Bell Laboratories to combine the organizational and design strengths of Simula

with C’s facilities for systems programming. The initial version of C++, called ‘‘C with

Classes’’ was first used in 1980;it supported traditional system programming

techniques and data abstraction. The basic facilities for object-oriented programming

were added in 1983 and object-oriented design and programming techniques were

gradually introduced into the C++ community. The language was first made

commercially available in 1985 . Facilities for generic programming were added to the

language in the 1987-1989 .As the result of widespread use and the appearance of

several independently-developed C++- 2 -implementations, formal standardization of

C++ started in 1990 under the auspices of the American National Standards Institute,

ANSI, and later the International Standards Organization, ISO, leading to an

international standard in 1998 [C++,1998]. During the period of standardization the

standards committee acted as an important focus for the C++ community and its draft

standards acted as interim definitions of the language.

C++ Design Aims

Page 14: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 14

C++ makes programming more enjoyable for serious programmers.

C++ is a general-purpose programming language that

– is a better C

– supports data abstraction

– supports object-oriented programming

- supports generic programming

C++ Design Principles

C++’s evolution must be driven by real problems.

C++ is a language, not a complete system.

Don’t get involved in a sterile quest for perfection.

C++ must be useful now.

Every feature must have a reasonably obvious implementation.

Always provide a transition path.

Provide comprehensive support for each supported style.

C++ Design-support rules:

Support sound design notions.

Provide facilities for program organization.

Say what you mean.

All features must be affordable.

It is more important to allow a useful feature than to prevent every misuse.

Support composition of software from separately developed parts.

C++ Language-technical rules

No implicit violations of the static type system.

Provide as good support for user-defined types as for built-in types.

Locality is good.

Page 15: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 15

Avoid order dependencies.

If in doubt, pick the variant of a feature that is easiest to teach.

Syntax matters (often in perverse ways).

Preprocessor usage should be eliminated

Major C++ Enhancements

. C++ supports object-oriented programming features e.g., abstract classes, inheritance, & virtual methods

. C++ supports data abstraction & encapsulation e.g., the class mechanism & name spaces

C++ supports generic programming e.g., parameterized types

C++ supports sophisticated error handling e.g., exception handling

C++ supports identifying an object's type at runtime

Important Minor Enhancements

C++ enforces type checking via function prototypes

Provides type-safe linkage

Provides inline function expansion

Declare constants that can be used to define static array bounds withthe const type qualifier

Built-in dynamic memory management via new & delete operators

Namespace control

The name of a struct, class, enum, or union is a type name

References allow \call-by-reference" parameter modes

New type-secure extensible iostreams I/O mechanism

\Function call"-style cast notation

Page 16: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 16

Several different commenting styles

New mutable type qualifier

New bool boolean type

Page 17: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 17

SYSTEM ANALYSIS

Page 18: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 18

2. SYSTEM ANALYSIS

System analysis is the process of gathering and interpreting facts,

diagnosing problems and using the facts to improve the system. System specifies

what system should do. A system is a set of components that interact to accomplish

some purpose.

• Identifying the drawback of the existing system

• Identify the need for conversion

• Perform feasibility study

• Identify hardware, software and database requirements

• Create a system definition that forms the foundation for subsequent

work

2.1 SYSTEM STUDY

� PROBLEM STATEMENT

Implement an algorithm which perform all arithmetic operation on Large

number with O(n) time complexity and less space complexity

� PROPOSED SYSTEM

The Proposed algorithm should satisfy all the features of the existing

algorithm, barring the some disadvantages. The Proposed algorithm

• Allows faster workflow

• Less space complexity

• Only take simple shifting operation and basic arithmetic operation on

primary data type

• Use recursive algorithm

� BENEFITS OF THE PROJECT

• It minimize time and work.

Page 19: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 19

• Use simple

• Useful in implementation in RSA, Digital Signature etc cryptographic algorithm

implementation.

• Very useful in Network security algorithm implemention

.

2.2 FEASIBILITY STUDY The feasibility of a project can be ascertained in terms of technical factors, economic

factors, or both. A feasibility study is documented with a report showing all the

ramifications of the project

Technical Feasibility. Technical feasibility refers to the ability of the process to take

advantage of the current state of the technology in pursuing further improvement. The

technical capability of the personnel as well as the capability of the available

technology should be considered. Technology transfer between geographical areas and

cultures needs to be analyzed to understand productivity loss (or gain) due to

differences (see Cultural Feasibility). Since we are using c++ and so on so technically

our project is feasible.

Economic Feasibility. This involves the feasibility of the proposed project to generate

economic benefits. A benefit-cost analysis and a breakeven analysis are important

aspects of evaluating the economic feasibility of new industrial projects. The tangible

and intangible aspects of a project should be translated into economic terms to facilitate

a consistent basis for evaluation.

Financial Feasibility. Financial feasibility should be distinguished from economic

feasibility. Financial feasibility involves the capability of the project organization to

raise the appropriate funds needed to implement the proposed project. Project

financing can be a major obstacle in large multi-party projects because of the level of

capital required. Loan availability, credit worthiness, equity, and loan schedule are

important aspects of financial feasibility analysis.

Page 20: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 20

Cultural Feasibility. Cultural feasibility deals with the compatibility of the proposed

project with the cultural setup of the project environment. In labor-intensive projects,

planned functions must be integrated with the local cultural practices and beliefs. For

example, religious beliefs may influence what an individual is willing to do or not do.

Social Feasibility. Social feasibility addresses the influences that a proposed

project may have on the social system in the project environment. The ambient

social structure may be such that certain categories of workers may be in short

supply or nonexistent. The effect of the Project on the social status of the

project participants must be assessed to ensure compatibility. It should be

recognized that workers in certain industries may have certain status symbols

within the society.

.

Market Feasibility. Another concern is market variability and impact on the

project. This area should not be confused with the Economic Feasibility. The

market needs analysis to view the potential impacts of market demand,

competitive activities, etc. and "divertible" market share available. Price war

activities by competitors, whether local, regional, national or international, must

also be analyzed for early contingency funding and debt service negotiations

during the start-up, ramp-up, and commercial start-up phases of the project.

Scope of Feasibility Analysis

In general terms, the elements of a feasibility analysis for a project should cover the

following:

• Need Analysis. This indicates recognition of a need for the project. The need

may affect the organization itself, another organization, the public, or the

government. A preliminary study is then conducted to confirm and evaluate the

need. A proposal of how the need may be satisfied is then made. Pertinent

questions that should be asked include:

� Is the need significant enough to justify the proposed project?

� Will the need still exist by the time the project is completed?

Page 21: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 21

� What are the alternate means of satisfying the need?

� What are the economic, social, environmental, and political impacts of the

need?

• Process Work. This is the preliminary analysis done to determine what will be

required to satisfy the need. The work may be performed by a consultant who is

an expert in the project field. The preliminary study often involves system

models or prototypes. For technology-oriented projects, artist's conception and

scaled-down models may be used for illustrating the general characteristics of a

process. A simulation of the proposed system can be carried out to predict the

outcome before the actual project starts.

• Engineering & Design. This involves a detailed technical study of te proposed

project. Written quotations are obtained from suppliers and subcontractors as

needed. Technology capabilities are evaluated as needed. Product design, if

needed, should be done at this time.

• Cost Estimate. This involves estimating project cost to an acceptable level of

accuracy. Levels of around -5% to +15% are common at this level of a project

plan. Both the initial and operating costs are included in the cost estimation.

Estimates of capital investment and of recurring and nonrecurring costs should

also be contained in the cost estimate docuement. Sensitivity analysis can be

carried out on the estimated cost values to see how sensitive the project plan is

to the estimated cost values.

• Financial Analysis. This involves an analysis of the cash flow profile of the

project. The analysis should consider rates of return, inflation, sources of

capital, payback periods, breakeven point, residual values, and sensitivity. This

is a critical analysis since it determines whether or not and when funds will be

Page 22: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 22

available to the project. The project cash flow profile helps to support the

economic and financial feasibility of the project.

• Project Impacts. This portion of the feasibility study provides an assessment

of the impact of the proposed project. Environmental, social, cultural, political,

and economic impacts may be some of the factors that will determine how a

project is perceived by the public. The value added potential of the project

should also be assessed. A value added tax may be assessed based on the price

of a product and the cost of the raw material used in making the product. The

tax so collected may be viewed as a contribution to government coffers.

• Conclusions and Recommendations. The feasibility study should end with

the overall outcome of the project analysis. This may indicate an endorsement

or disapproval of the project. Recommendations on what should be done should

be included in this section of the feasibility report.

Page 23: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 23

SOFTWARE REQUIREMENTS

SPECIFICATION

3.1 USER CHARACTERISTICS

The developer are the user of this project who have the right to

access this project. They will use this algorithm in different area of computer.

3.2 REQUIREMENT SPECIFICATION

This is the set of activities that lead to the

production of requirements definition and requirement specification. In

requirement engineering first of all feasibility study, in this study we try to find out

the need and requirements of the customer. They are satisfied with our product and

also happy with our proposed system. We include the personnel assignments, costs,

project schedule, and target date. This helps us to go ahead with our project.

Requirement definition is the most crucial part of the project.

Incorrect, inaccurate, or excessive definition of requirements must necessarily

result in schedule delays, wasted resources, or customer dissatisfaction.

The basic document that is needed is called Requirement

Specification. In other words a description of what you want the system to do.

Sometimes the requirement definition is presented as an

introduction to requirement specification. There are five requirements that a

software requirement document should satisfy,

• It should specify external behavior

• It should specify constraints on the implementation

• It should be easy to change

• It should serve as a reference tool

• It should record throughout the life cycle

Page 24: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 24

There are two types of requirements:

� FUNCTIONAL REQUIREMENT

� NON FUNCTIONAL REQUIREMENT

3.3 FUNCTIONAL REQUIREMENTS

Functional requirement describes the relationship between the input and

the output of the system. The functional requirements of the project are given

below.

Functional requirement describes the relationship between the input and the output

of the system. The functional requirements of the project are given below.

• TAKING THE INPUT LARGE INTEGER NUMBER

• PERFORM THE RELATIVE PRIMILITY CHECHKING OF

TWO NUMBER OF THE FORM OF 2 N -1 FASTLY

• PERFORM THE FAST GCD CALCULATION OF NUMBER

THE FORM OF 2N -1

• PERFORM THE MOD(%) OPERATION WITHOUT DIVISION

• PERFORM ADDITION (+) AND SUBTRACTION (-) WITHIN

O(N) TIME USING MODULAR ARITHMETICS

• PERFORM FAST MULTIPLICATION USING MODULAR

ARITHMETICS

• PERFORM DI VISIION ,POWER USING ABOVE OPERATION

FASTLY

� TAKING THE INPUT LARGE INTEGER NUMBER

For this operation we take the large input of integer type which will be

stored as a character pointer. By Decimal to Two complement representation and

Page 25: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 25

vice versa, using Packing that number into Bit representation and unpacking that

Bit representation we perform all operation.

� PERFORM THE RELATIVE PRIMILITY CHECHKING OF TWO

NUMBER OF THE FORM OF 2 N -1 FASTLY

We take the modulus number as mj = 2e3 – 1 that is , each

modulus is one less than a power of 2. Such a choice of rnj often makes the basic

arithmetic operations simpler, because it is relatively easy to work modulo 2ej - 1, as in

ones’ complement arithmetic.

� PERFORM THE FAST GCD CALCULATION OF NUMBER THE

FORM OF 2N -1

Perform the GCD of two number by bitwise operation(left &

right shift),addition and subtraction in less complexity time.

• PERFORM THE MOD(%) OPERATION WITHOUT DIVISION

To perform modulus we represent that number into bit representation and then

represent that into polynomial of integer using modulo operation and addition

we do this operation.

� PERFORM ADDITION (+) AND SUBTRACTION (-) WITHIN O( N)

TIME USING MODULAR ARITHMETICS

By using modulus operation then CHINESE REMAINDER theorem

we perform both operation in less time and space complexity.

� PERFORM FAST MULTIPLICATION USING MODULAR

ARITHMETICS

Page 26: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 26

By using modulus by bit representation method, recursive

multiplication, chopping of bitwise number, MULTIPLICATIVE INVERSE and GCD

of co prime NUMBER, Chinese

Remainder thermo we perform this operation in o(n) time complexity.

� PERFORM DI VISIION ,POWER USING ABOVE OPERATION

FASTLY

By using above operation +,-,*.and % we perform Division(/) and

power(Exponent) fastly.

3.4 NON-FUNCTIONAL REQUIREMENTS

Nonfunctional requirements define system properties and

constraints it arises through user needs, because of budget constraints or

organizational policies, or due to the external factors such as safety regulations,

privacy registration and so on. Nonfunctional requirements are:

• Security

• Reliability

• Maintainability

• Portability

• Extensibility

• Reusability

• Application Affinity/Compatibility

• Resource Utilization

Page 27: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 27

Non-Functional Requirements

3.5 Constraints

There are following constraints that user have to do

(1) Number will be only decimal number

(2) only numerical value is valid

(3) sufficient memory should be there for storing large number

(4) Basic knowledge of c++

3. 6 Specific Requirements

3.6.1 External Interfaces

Page 28: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 28

All the input and output will be in the file .user have to give input in file and result will

be stored in given file.

User will find following option:

• Name of operation

• Input option

• Source of input or destination of output

• Valid range, accuracy and/or tolerance

• Units of measure

• Timing

• End messages

3.6.2 Functions These are following list should be starting with The system

These include:

* Validity checks on the inputs: Input should be valid numeric type

decimal number

* Exact sequence of operations:

operation will be following sequence :

(a) Addition(+)

(b) Subtraction(-)

(c) Multiplication(*)

(d) Division(/)

(e) Modulus(%)

(f) Power(Exponent)

* Responses to abnormal situation:

* Overflow:-Give the messege of overflow

* Error handling and recovery

Page 29: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 29

Page 30: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 30

Challenges in This Field In the field of classification and rules establishment, the basic problems are the features

extraction (building blocks of algorithms) and selection of good algorithms

those can generate results with high certainty value.

4.1 Fast calculation

The initial problem is the problem is how can we do all the operation firstly.

Generally addition and subtraction operation performed o(n) time complexity

but multiplication operation always perform in o(n2) by classical approach , so it

is very difficult to apply an algorithm which perform multiplication operation in

less time. By using modular arithmetic we perform multiplication operation in

O(n log n) or O(n) time. we perform all these operation recursively. By

applying these three operation and shifting operation we perform all operation

fastly. 4.2 selection of Algorithms

The second problem is to choose different algorithm that can interpret the problem

in best way and utilize it. Against the classical algorithm we apply some number

theoretic algorithm in modular arithmetic approach by which we can perform

all operation fastly.

Page 31: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 31

APPROACHES IN THIS DIRECTION

In this section the various algorithms will be discussed being used to

achieve the objective

MODULAR ARITHMETIC APPORACH FOR BASIC

OPERATION

By using Modular Arithmetic we may do all operation in O(n) or O(log n) time.The

idea is to have several modulus m1,m2 ………mr that contains no common factors and

to work indirectly with residues with u mod m1, u mod m2, …………. u mod mr

instead of directly with number u.

Let

U1 = u mod m1

U2 = u mod m2

……………..

……………..

Ur = u mod mr

It is easy to compute (u1,u2,…,ur) by using some algorithm then

by applying Chinese remainder theorem we find desired result. The advantage of

modular arithmetic are addition, subtraction and multiplication are very simple. By

using these three operation we perform division, modulus, power and other

arithmetic operation. All these operation are done by using shifting and other basic

arithmetic operation defined by operating system on basic data types.

Page 32: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 32

5.1 Calculate several modulus m1,m2 ………mr that contains

no common factors

For modular approach we have to calculate different modules m1,m2 ………mr such

that if u and v are two large input number on which we have to perform operation

then there exist any m such that

m = m1m2m3……….mr

then

0 ≤ u ≤ v < m

All m1,m2 ………mr relatively prime. For this we apply following rules. Let there be a

sequence be

q0 = 1, qk+1 = 3.qk-1

so that qk = ½(3k + 1) .By using this qk bit number we can multiply pk = (18.qk+8) bit

number.

When we perform two pk bits number, the idea is to use six moduli is

m1 = 26.qk-1 -1 m2 = 26.q

k+1 -1 m3 = 26.qk+2 -1

m4 = 26.qk+3 -1 m5 = 26.q

k+5 -1 m6 = 26.qk+7 -1

These moduli are relatively prime. Since the exponent

6.qk-1, 6.qk+1, 6.qk+2, 6.qk+3, 6.qk+5 and 6.qk+7

are always prime. These six moduli are capable to representing

m = m1m2m3……….mr > 236qk+16 bit numbers.

5.2 Calculate several modulus corresponds to m1,m2

………mr

To calculate the modulus we chopping the binary representation of large integer into

The size of their moduli. In this situation the number just as packing and addition of

Number upto their moduli bit length.This rule perform only on that moduli which is in

form of 2n-1 form.All moduli we generate is in that form. So modular is just addition of

number.Let the binary representation of u with blocks of ej bits are grouped

together.then

U = atAt + at-1A

t-1 + at-2At-2 + at-3A

t-3 + ……….+a1A +a0

Where A = 2ej and 0 ≤ ak < 2ej for 0 ≤ k ≤ t.then

U = at + at-1+…………+a1+a0(modulo 2ej -1)

Page 33: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 33

5.3 Calculate different modulus operation corresponds to

m1,m2 ………mr

After getting different modulus we have to perform different modulus operation.The

advantage of modular representation are that addition,subtraction and multiplication are

very simple

(u1,…..…,ur) + (v1…….,vr) = ((u1+v1) mod m1,……….,(ur+vr) mod mr)

(u1,…..…,ur) - (v1…….,vr) = ((u1-v1) mod m1,……….,(ur-vr) mod mr)

(u1,…..…,ur) * (v1…….,vr) = ((u1*v1) mod m1,……….,(ur*v r) mod mr)

Division operation are performed using all the

above opearation and modular division.These are general modular operation but when

the modulus are in special form then the operation are too easy.If the modulus are in the

form of mj = 2ej -1 then

uj + vj = ((uj+ vj) mod 2ej) +[uj + vj ≥ 2j] uj + vj = ((uj* v j) mod 2ej) +[ujvj / 2j]

uj - vj = ((uj - vj) mod 2ej) -[uj < vj]

These operation can be performed efficiently even when when 2ej is larger than the computer’s word size,since it is a simple matter to compute the remainder of a positive number modulo a power of 2 or to divide a number by power of 2. If the moduli of the form of 2ej – 1 are to be used,than the condition the Number 2e-1 is relatively prime to the number 2f -1.so Gcd(2e -1,2j - 1) = 2gcd(e,f) – 1 Modulus operation are to be performed division and subtraction operation .Exponent operation are to be done by repeatly multiplication.

5.3 Calculate Chinese remainder operation corresponds to

different modulo m1,m2 ………mr

Chinese remainder method provide usable method of conversion from (u1,u2,….,ur) to

u.Such a method carried by a constant cij for 1 ≤ i < j ≤ r ,where

cijmi = 1(modulo mj)

These constants cij are readly computed using Euclid’s algorithm

,since for any given i and j algorithm will determine a and b such that ami+bmj =

gcd(mi,mj) = 1but when modulo are in special form then 2ej – 1then cij are determined

by following rules

Given that (e mod f) and (ce mod f) = 1 then

Page 34: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 34

((1+2d+……+2(c-1)d).(2e -1)) mod (2e – 1) = 1

Then

V1 = u1mod m1

V2 = (u2 – u1)c12 mod m2

V3 = ((u3- v1)c13 – v2)c23 mod m3

……………………………………………………

……………………………………………………..

………………………………………………………

Vr = (…((ur – v1)c1r – v2)c2r - ……-vr-1)c(r-1)r mod mr

Then

U = vrmr-1….m2m1+……+v3m2m1+v2m1+v1

So that we find the result.so only

O(n log n) cycles are required.

Page 35: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 35

SOFTWARE QUALITY ASSURANCE

PLAN

6.1 PURPOSE

The purpose of this plan is to define the “Customer Relationship

Management” Software Quality Assurance (SQA) organization, SQA tasks and

responsibilities; provide reference documents and guidelines to perform the SQA

activities; provide the standards, practices and conventions used in carrying out

SQA activities; and provide the tools, techniques, and methodologies to support

SQA activities, and SQA reporting.

6.2 SCOPE The scope of this document is to outline all procedures,

techniques and tools to be used for quality assurance of this project.

This plan:

• Identifies the SQA responsibilities of the project developer and the SQA consultant

• Lists the activities, processes, and work products that the SQA consultant will review and audit

• Identifies the SQA work products

.

6.3 OVERVIEW OF THE DOCUMENT

The rest of the document is organized as follows:

Page 36: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 36

Management: A description of each major element of the organization and a

description of the SQA tasks and their relationships

Documentation: Identification of the documents related to development, verification,

validation, use and maintenance of the software.

SQAP Requirements: This section defines the SQA review, reporting, and auditing

procedures used to ensure that software deliverables are developed in accordance

with this plan and the project’s requirements.

6.3.1 Management

This section describes the management organizational structure,

its roles and responsibilities, and the software quality tasks to be performed.

6.3.2 Organization

Efforts for this project are supported by numerous entities,

organizations and personnel. This tool is developed as part of partial fulfillment of

requirements for Masters in Computer Applications degree. It will be the sole

responsibility of the developer to review the product’s usability, efficiency,

reliability, and accuracy. The client will however conduct inspections, reviews, and

walk-through on a regular basis. Client’s specifications and suggestions will be

used in places where quality decisions need to out-weigh development schedule

decisions.

6.4 TASKS AND RESPONSIBILITIES

• Develop the requirement specification and cost estimation for the project

• Develop the design plan and test plan for testing the tool

• Implement and test the application and deliver the application along with

the necessary documentation

Page 37: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 37

• Give a formal presentation to the client on completion of the analysis,

design and testing phases. The client reviews the work and provides

feedback/suggestions.

• Planning, coordinating, testing and assessing all aspects of quality

issues.

The responsibilities of the client are to:

• Review the work performed.

• Provide feedback and advice.

6.5 SQA IMPLEMENTATION IN DIFFERENT

PHASES Quality assurance will be implemented through all the software

life cycles of the tool’s development process, until the release of the software

product. The following are the quality assurance tasks for each phase of the

software development:

Requirements phase: When the SRS is being developed, it has to be ensured that it

elucidates the proposed functionality of the product and to keep refining the SRS

until the requirements are clearly stated and understood.

Specification and Design phase: Due to the great importance for accuracy and

completeness in these documents, weekly reviews shall be conducted between the

developer and the client to identify any defects and rectify them.

Page 38: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 38

Implementation phase: The developer shall do code reviews when the construction

phase of the Tool begins.

Software testing phase: The developer shall test each case. The final product shall

be verified with the functionality of the software as specified in the Software

Requirements Specification (SRS) for the Tool.

6.6 DOCUMENTATION

In addition to this document, the essential documentation will include:

The Software Requirements Specification (SRS), which

• Prescribes each of the essential requirements (functions, performances,

design constraints and attributes) of the software and external interfaces

• Objectively verifies achievement of each requirement by a prescribed

method (e.g. Inspection, analysis, demonstration or test)

• Facilitates traceability of requirements specification to product delivery.

• Gives estimates of the cost/effort for developing the product including a

project plan.

The Software Design Document (SDD)

• Depicts how the software will be structured

• Describes the components and sub-components of the software design,

including various packages and frameworks, if any.

• Gives an object model that is developed using Rational Rose

highlighting the essential classes that would make up the product.

• Gives a sample interaction diagram, showing the key interactions in the

application. This should also be a part of the object model.

Page 39: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 39

Software Test Plan: Describes the test cases that will be employed to test the

product.

6.7 SOFTWARE DOCUMENTATION AUDIT Quality Assurance for this project will include at least one

review of all current work products in each stage of development (Requirement,

Design, and Implementation). The reviews will assure that the established project

processes and procedures are being followed effectively, and exposures and risks

to the current project plan are identified and addressed. The review process

includes:

• A formal presentation at the end of each development phase

(Requirement, Design and Implementation). All current work products

are presented to the client for review.

• A managerial review by the client periodically to ensure the work

generated is in compliance with project requirements.

• Reviews by the client after each presentation.

6.8 REQUIREMENTS TRACEABILITY The SRS will be used to check off the deliverables. The Project

Review will ensure that each of the requirements mentioned in the SRS is met by

the deliverables.

Page 40: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 40

6.9 SOFTWARE DEVELOPMENT PROCESS The software development process involves three stages: 1)

Requirements phase, 2) Design phase 3) Implementation and testing phase. During

each phase, the client will review the deliverable documents. The developer would

incorporate modifications suggested by the committee. This would ensure quality

of the software product.

6.10 PROJECT REVIEWS

The client will perform a review at the 3 stages of the project as

described in the section above. This review will determine whether the

requirements have been met for the deliverable, check that the product meets the

requirements, ensure that the SQA plan has been adhered to, verify the

performance of the software and ensure that acceptance testing is carried out. A

design checklist will be used and the developer will check to see whether the

design meets the checklist criteria.

6.11 TESTING AND QUALITY CHECK Testing will be carried out in accordance with the Software

Testing Plan (STP). Testing documentation will be sufficient to demonstrate that

testing objectives and software requirements have been met. Test results will be

documented and discussed in the final phase of the project.

Page 41: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 41

SYSTEM DESIGN

Page 42: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 42

SYSTEM DESIGN

System design provides the understanding and procedural details

necessary for implementing the system recommended in the system study.

Emphasis is on translating the performance requirements into design specifications.

The Design phase is a transition from a user-oriented document (system proposal)

to a documented oriented to the programmers or database personnel.

Systems design is the process or art of defining the architecture,

components, modules, interfaces, and data for a system to satisfy

specified requirements. One could see it as the application of systems

theory to product development.

This project has to implement a software for the purpose of

implementing the algorithm for arithmetic operation for large number using

modular arithmetic. The system must be designed to retrieve input from file and

display the results in a formatted manner in file..

7.1 ARCHITECTURAL DESIGN

It defines the relationship between major structural elements of

the program. This design representation the modular framework of a computer

program can be derived from the analysis models and the interaction of the

subsystems defined within the analysis models. The primary objective is to develop

a modular program structure and data structure, defining interfaces that enable the

conceptual view of software product. This means performing a number of tasks

that such as decomposing the specification into software modules, indentifying the

interfaces and interconnections among the functions and sub functions, identifying

the data used and passed among the functions and finally identifying where data is

stored.

Page 43: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 43

The basic architecture for the proposed system is like that

Presentation Layer: All the C++ codes for desired output are written in this tier.

Business Layer: All the logic code are written here.

DAO Layer: All the data(text files) related codes are written here.

7.2 PROCESS DESIGN

PRESENTATION LAYER

DAO (DATA ACCESS OBJECT) LAYER

BUSINESS LAYER

Page 44: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 44

V-MODEL OF DEVELOPMENT

V Process is a whole life-cycle process. V process must be applied at

each stage in the software process.

OBJECTIVE

The V_Model (Lifecycle Process Model) regulates the system

development process and the maintenance and modification of systems.

This standard helps to achieve the following objectives:

� Improvement and guarantee of the quality:

- The discovery of defects in a system.

- The assessment of whether or not the system is usable in an operational situation.

- The completeness of the results to be delivered can best be guaranteed by a

standardized procedure.

- Defined interim results make early assessment procedures possible. Uniform

product contents alleviate the readability of the products and the assessment

procedures.

Page 45: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 45

� Checking the costs for the whole lifecycle:

- The generation of relevant project-specific development standards and its

assessment will be simplified.

- The standardized procedure makes the cost calculation more transparent. Any risks

in connection with the costs can be recognized better.

- Uniform standards reduce friction losses between customer and contractor as well

as between main contractor and subcontractor.

- Standardized procedures allow for the reduction in the use of resources.

- In case of a standardized procedure universal approaches to the solutions become

transparent and can thus be used.

- Undesirable developments are recognized ataan earlier stage.

- The training costs are reduced.

� Improvement in the communication between the different parties, as well as a

reduction in the dependence of the customer on the contractor:

- Using defined terms reduces misunderstandings between all parties involved.

- The user, the purchaser, and the developer will be supported when formulating

their requirements/when describing their parts or results.

- The interim results/final results are standardized to such an extent that other parties

involved or staff of other companies are able to settle in without very much effort,

if necessary.

Page 46: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 46

DATA DESIGN

Page 47: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 47

8.1 DATA FLOW DIAGRAM A data flow diagram is a graphical technique that depicts

information flow and transforms that are applied as data move from input to

output. The DFD is used to represent increasing information flow and functional

details. A level 0 DFD, also called fundamental system model or a Context model,

represents the entire software elements as a single bubble with input and output

indicated by incoming and outgoing arrows respectively. Additional process and

information flow parts are represented in the next level i.e., Level 1 DFD. Each of

the processes represented at Level 1 are sub functions of overall system depicted in

the Context model. Any processes, which are complex in Level 1, will be further

represented into sub functions in next level, i.e., in Level 2.

• Data flow diagrams illustrate how data is processed by a system in terms of

inputs and outputs. Represents major components or functions with circles

• Actions for input by user or system go in rectangular boxes

• Databases are represented by parallel lines enclosing a phrase corner

BASIC DFD SYMBOLS:

To construct a Data Flow Diagram, we use

Square representing external entities, which are sources

or destinations of data.

Circles representing processes, which take data as input,

do something to it, and output it.

Arrows representing the data flows, which can either be

electronic data or physical items.

Page 48: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 48

Open-ended rectangles representing data stores, including

electronic stores such as databases or XML files and

physical stores such as or filling cabinets or stacks of

paper.

PROCESS

The process shape represents a task that handles data within the

application. The task may process the data or perform an action based on the data.

MULTIPLE PROCESS

The multiple process shape is used to present a collection of sub processes.

The multiple process can be broken down into its sub processes in another DFD.

EXTERNAL ENTITY

The external entity shape is used to represent any entity outside the

application that interacts with the application via an entry point.

DATA FLOW

The data flow shape represents data movement within the application. The

direction of the data movement is represented by the arrow.

DATA STORE

The data store shape is used to represent locations where data is stored.

Data stores do not modify the data, they only store data.

PRIVILEGE BOUNDARY

The privilege boundary shape is used to represent the change of privilege

levels as the data flows through the application.

DATA FLOW DIAGRAM LAYERS

Page 49: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 49

Draw data flow diagram in several nested layers. A single

process node on a high level diagram can be expanded to show a more detailed

data flow diagram. Draw the context diagram first, followed by various layers of

data flow diagrams.

LEVEL 0 :- (CONTEXT DIAGRAM)

REQUEST REQUEST

INPUT.TXT RESULT RESULT

USER OPERATION

Page 50: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 50

LEVEL 1 :- INPUT.TXT OUTPUT.TXT

INPUT.TXT

OUTPUT.TXT

INPUT.TXT

OUTPUT.TXT

INPUT.TXT

OUTPUT.TXT

INPUT.TXT

OUTPUT.TXT

INPUT.TXT OUTPUT.TXT

USER MENU

ADDITION

SUBTRACTION

MULTIPLICATION

DIVISION

MODULUS

POWER

Page 51: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 51

8.2 HEADER FILES

� iostream.h � fstream.h � math.h � ctype.h � LongInt.h � Chinese.h � Operation.h � GenerateMod.h � basicOperation.h � division.h � Mod.h � Power.h

• iostream.h -> all input /output function declare in this file.

• fstream.h -> all file input /output function declare in this file

• math.h -> all math function declare in this file

• ctype.h ->

• LongInt.h-> it is a user defined header file .it contained following declearation->

typedef unsigned char uchar;

typedef unsigned short ushort;

typedef unsigned long ulong;

enum Rep { ADec, AOct, Dec, Oct, Bcd,

Page 52: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 52

TComp, SMag

}; Class LongInt {

uchar *num; ushort len; Rep rep; public: LongInt(); LongInt Compact(uchar*, ushort, const Rep& );

void Correct(uchar , uchar* , uchar*, const ushort&);

LongInt DecToTComp(LongInt &);

void Pack(LongInt & , const uchar*, const uchar&,const ushort&);

void Print(); void PrintBytesL(LongInt*); void PrintDec(LongInt &, const uchar&); void PrintBcd(LongInt &); void PrintSMag(LongInt &); void print(LongInt &); LongInt Read(FILE* fp);

LongInt SpaceAlloc(const ushort& , const Rep& , uchar* );

void TwoComp(LongInt *); LongInt TCompToDec(); uchar *UnPack(LongInt &, ushort);

Page 53: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 53

LongInt Mod2( LongInt & , LongInt &); void performmod(LongInt); ~ LongInt(){ } };

template<class In, class Out>

void Copy(Out* a, In* b, ushort len); int IsPow2(const uchar& x); void Error(const char* s); void Init(uchar*a, ushort len,const uchar& val); uchar Skip(FILE *fp, uchar& c); uchar GetDigit(const uchar& s,const uchar& k, uchar& right,const uchar& j); uchar Getbit(const uchar& x,const uchar& p); ushort OctToDec(uchar* a,const ushort& len); ushort DecToOct(uchar* a, const ushort& len);

• operation.h-> It is a user defined header file.it contained following declearation.

Class operation : public LongInt { Public: ushort bitlength(); void operator << (ushort); void operator >> (ushort); uchar Iszero();

Page 54: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 54

short operator > (LongInt ); short operator < (LongInt); short operator ==(LongInt); long int convertlong(); LongInt convertLongInt(LongInt); LongInt Compact(uchar*,ushort ,const Rep&); };

uchar Lift(uchar* , uchar , long ,const ushort&); uchar InvalidBits(const uchar& x); ushort InvalidBytes(uchar* ,const ushort&);

• GenerateMod.h->It is a user defined header file.the decleration are following

class GenerateMod:public operation { Public: LongInt Generate(ushort a); LongInt Mod2( LongInt & , LongInt &);

LongInt Mod3(LongInt & , LongInt &);

void GenerateMod(LongInt *,LongInt &,LongInt &);

LongInt chopping(LongInt & ,LongInt &); }; ushort Genqk(ushort);

Page 55: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 55

• Chinese.h-> It is a user defined header file. The

declared function are following..

Class chinses:public GenerateMod { Public: LongInt Ccalculate(LongInt ,LongInt );

Void inverse(LongInt ,LongInt,LongInt (*)[6]);

}; Short gcd(short,short); Void swap(short *,short *);

• basicOperation.h->It is a user defined header file. The declaration are following..

class basicOperation: public Chinese { LongInt ModAdd(LongInt,LongInt,LongInt); LongInt Add1(LongInt &,LongInt &); LongInt operator +(LongInt &); LongInt ModSub(LongInt,LongInt,LongInt); LongInt sub1(LongInt &,LongInt &); LongInt operator -(LongInt &);

LongInt ModMult(LongInt &,LongInt &,LongInt &); LongInt mult1(LongInt &x,LongInt &y);

LongInt operator *(LongInt & b);

LongInt Result(LongInt *,LongInt*);

Page 56: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 56

};

• division.h->It is a user defined header file.The decleration are following..

class division :public basicOperation { Public: LongInt MOddiv(LongInt,LongInt,LongInt); LongInt Div1(LongInt &,LongInt &); LongInt operator /(LongInt &); }

• Mod.h-> It is a user defined header file.The decleration are following..

class mod :public division { Public: LongInt Mod1(LongInt,LongInt,LongInt); LongInt Mod2(LongInt &,LongInt &); LongInt operator %(LongInt &); }

• Power.h-> It is a user defined header file.The decleration are following..

class power :public basicOperation

Page 57: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 57

{ Public: LongInt Pow1(LongInt &,LongInt &); LongInt pow(LongInt &); };

Page 58: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 58

8.3 USE CASE DAIGRAM � USE CASE FOR COMPUTER ARITHMETIC OPERATION

USER

� USE CASE FOR READ OPERATION

USER

<<extend>>

<<include>>

<<include>>

<<include>> <<include>>

<<include>> <<include>>

Read

ADDITION

SUBTRACTION

MULTIPLICATION

DIVISION

MOD POWER

Invalid input

<<include>>

<<include>> <<include>>

<<include>>

<<exclude>>

<<exclude>>

Read

OPEN FILE

PRINT INPUT

INVALID INPUT

FILE CAN’T OPENED

READ CHARACTER

ALLOCATE SPACE

Page 59: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 59

� USE CASE FOR ADDITION OPERATION

USER

� USE CASE DIAGRAM FOR SUBTRACTION

USER

SYSTEM TESTING

<<include>>

<<include>> <<include>>

<<include>> <<include>>

<<include>>

<<exclude>>

ADDITION

READ

PRINT RESULT

APPLY CHINESE REMAINDER

OUT OF MEMORY

GENERATE RESIDU

GENERATE MOD

ADD & MOD

<<include>>

<<include>> <<include>>

<<include>> <<include>>

<<include>>

<<exclude>>

SUBTRA CTION

READ

PRINT RESULT

APPLY CHINESE REMAINDER

OUT OF MEMORY

GENERATE RESIDU

GENERATE MOD

SUBTRACT& MOD

Page 60: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 60

� USE CASE DIAGRAM OF MULTIPLICATION

USER � USE CASE DIAGRAM OF MULTIPLICATION

USER

<<include>>

<<include>> <<include>>

<<include>> <<include>>

<<include>>

<<exclude>>

SUBTRA CTION

READ

PRINT RESULT

APPLY CHINESE REMAINDER

OUT OF MEMORY

GENERATE RESIDU

GENERATE MOD

SUBTRACT& MOD

<<include>>

<<include>> <<include>>

<<include>> <<include>>

<<include>>

<<exclude>>

SUBTRA CTION

READ

PRINT RESULT

APPLY CHINESE REMAINDER

OUT OF MEMORY

GENERATE RESIDU

GENERATE MOD

MULT& MOD

Page 61: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 61

� USE CASE DIAGRAM OF DIVISION

USER � USE CASE DIAGRAM OF MODULUS

USER

<<include>>

<<include>> <<include>>

<<include>> <<include>>

<<include>>

<<exclude>>

SUBTRA CTION

READ

PRINT RESULT

APPLY CHINESE REMAINDER

OUT OF MEMORY

GENERATE RESIDU

GENERATE MOD

MULT& MOD

<<include>>

<<include>>

<<include>>

<<exclude>>

SUBTRA CTION

READ

PRINT RESULT

OUT OF MEMORY

DIVISION

SUBTRACTION

Page 62: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 62

� USE CASE OF POWER

USER

<<include>>

<<include>>

<<exclude>>

SUBTRA CTION

READ

PRINT RESULT

OUT OF MEMORY

MULTIPLICATION

Page 63: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 63

8.4 SEQUENCE DIAGRAM

(1)Read file (2) Read succcessfull < - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

(3) generate moduli

(4) call diff erent opera tion

(5) select operation +,- ,* Loop n (6) perform operational task (7) perf orm chi nese op eration (8) return result

(9) store result

(5)select operation /

Loop n (6)perform operational task

(8)perfor (7)perfo M chines rm basic e operatio operatio (9)return result (10)store result

LongInt Operation

GenerateMod Chinese Basic Div Text file

Mod Pow

Page 64: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 64

(5)select operation %

Loop n (6)perform operational task

(9)chines (8)basic (7)do div e operatio operatio ision

(10)return result

(11) return result

(5)select operation power Loop n (6)perform operational task

(7)multiplication (8)chines e operation

(9)store result (10)store result

Page 65: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 65

8.5 CLASS DIAGRAM operation private:

public:

bitlength():ushort

LongInt private:

num: uchar * len: ushort rep: Rep

public :

LongInt() Compact(uchar*, ushort, const Rep& ):LongInt Correct(uchar,uchar*,uchar*,const ushort&): void DecToTComp(LongInt &): LongInt Pack(LongInt &,const uchar*,const uchar&,const ushort &):void Print():void PrintBytesL(LongInt*):void PrintDec(LongInt &, const uchar&):void PrintBcd(LongInt &):void PrintSMag(LongInt &):void print(LongInt &):void Read(FILE* fp):LongInt SpaceAlloc(const ushort& ,const Rep&,uchar* ):LongInt TwoComp(LongInt *):LongInt TCompToDec():LongInt UnPack(LongInt &, ushort):uchar * Mod2( LongInt & , LongInt &):LongIntid performmod(LongInt):void ~ LongInt()

Page 66: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 66

operator << (ushort):void operator >> (ushort):void

Iszero():uchar operator > (LongInt ):ushort operator < (LongInt):short

operator ==(LongInt):short convertlong():long int convertLongInt(LongInt):LongInt Compact(uchar*,ushort ,const Rep&):LongInt

GG

GenerateMod private: public:

Generate(ushort a):LongInt Mod2( LongInt & , LongInt &):LongInt Mod3(LongInt & , LongInt &):LongInt GenerateMod(LongInt *,LongInt &,LongInt ):void chopping(LongInt & ,LongInt &):LongInt

Chinese private: public:

Ccalculate(LongInt ,LongInt ):LongInt inverse(LongInt,LongInt,LongInt(*)[6]):Long Int

Page 67: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 67

Mod power private: private:

public: public:

Mod1(LongInt,LongInt,

LongInt):LongInt pow1(LongInt &,Lon

BesicOpeeration private: public:

ModAdd(LongInt,LongInt,LongInt):LongInt Add1(LongInt &,LongInt &):LongInt operator +(LongInt &):LongInt ModSub(LongInt,LongInt,LongInt):LongInt sub1(LongInt &,LongInt &):LongInt operator -(LongInt &):LongInt ModMult(LongInt &,LongInt &,LongInt &):LongInt mult1(LongInt &x,LongInt &y):LongInt operator *(LongInt & b):LongInt Result(LongInt *,LongInt*):LongInt

Division private: public:

MOddiv(LongInt,LongInt,LongInt):LongInt

Div1(LongInt &,LongInt &):LongInt

operator /(LongInt &):LongInt

Page 68: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 68

gInt):LongInt

Mod2(LongInt &,LongInt & pow(LongInt &):LongInt ):LongInt operator %(LongInt &):Lo ngInt

Page 69: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 69

TESTING

Page 70: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 70

SYSTEM TESTING

Testing is the penultimate step of software development. An

elaborate testing of the data is prepared and the system is using the test data.

While doing testing, errors are noted and correction is made. The users are

trained to operate the developed system. Both hardware and software securities

are made to run the developed system successfully.

System testing is aimed at ensuring the system works

accurately before the live operation commences. Testing is vital to the system.

System testing makes a logical assumption that if all parts of the system are

correct, the goal will be successfully achieved. The Proposal Tracking system

is subjected to a variety of tests; unit testing, integration testing and system

testing. A series of testing are performed for the proposed system before the

system is ready for user acceptance testing. Nothing is complete without

testing, as it is vital success of the system.

Normally, testing of any Large Systems will be in TWO parts.

The functional verification and validation against the Requirement Specification

and Performance evaluation against the indicated requirements. Testing activity is

involved right from the beginning of the project.

At the very first stage of testing, the goals and objectives are set.

This simplifies the limits or borders of testing process. Before testing, the tester

should plan what kind of data he is giving for test. Give data inputs as functional,

boundary, stress, performance, usability values etc.

Characteristics of a Good Test:

• Tests are likely to catch bugs

• No redundancy

• Not too simple or too complex

Page 71: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 71

Psychology of Testing

The aim of testing is often to demonstrate that a program works

by showing that it has no errors. The basic purpose of testing phase is to detect the

errors that may be present in the program. Testing is the process of executing a

program with the intent of finding errors.

TESTING OBJECTIVES

• The main objective of testing is to uncover a host of errors,

systematically and with minimum effort and time.

• Testing is a process of executing a program with the intent of finding an

error.

• A successful test is one that uncovers an as yet undiscovered error.

• A good test case is one that has a high probability of finding error, if it

exists.

• The tests are inadequate to detect possibly present errors.

• The software more or less confirms to the quality and reliable standards

7.1 LEVELS OF TESTING

Testing is usually relying on to detect the faults on each phase, in

addition to the faults introduced during the coding phase itself. Due to this,

different levels of testing are used in the testing process, each level of testing aims

to test different aspect of a system.

In order to uncover the errors present in different phases we have

the concept of levels of testing. The basic levels of testing are

Client Needs : Acceptance Testing

Requirements : System Testing

Page 72: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 72

Design : Integration Testing

Code : Unit Testing

� WHITE BOX TESTING

This is a unit testing method where a unit will be taken at a time

and tested thoroughly at a statement level to find the maximum possible errors.

I tested step wise every piece of code, taking care that every

statement in the code is executed at least once. The white box testing is also called

Glass Box Testing.

I have generated a list of test cases, sample data which is used to

check all possible combinations of execution paths through the code at every

Client

Requirements

Design

Code

Unit Testing

Integration Testing

System Testing

Acceptance

Page 73: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 73

module level. In this testing to test the code we use one method known as Black

box testing.

� BLACK BOX TESTING

This testing method focuses on the functional requirements of

the software. Here each module will be treated as a black box that will take some

input and generate output. Output for a given set of input combinations are

forwarded to other modules.

Black box testing attempts to find the following types of errors:

• Incorrect or missing functions.

• Interface errors.

• Errors in data structures or external database access.

• Performance errors

• Initialization errors and termination errors.

All the forms have been executed and verified. Based on some

sample input data, the generated output is verified whether the system is providing

better results or not.

STRATEGIC APPROACH TO SOFTWARE TESTING

The software engineering process can be viewed as a spiral.

Initially, system engineering defines the role of software and leads to software

requirement analysis where the information domain, functions, behavior,

performance, constraints and validation criteria for software are established.

Moving inward along the spiral, we come to design and finally to coding. To

develop computer software we spiral in along streamlines that decrease the level of

abstraction on each turn.

Page 74: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 74

A strategy for software testing may also be viewed in the context

of the spiral. Unit testing begins at the vertex of the spiral and concentrates on each

unit of the software as implemented in source code. Testing progresses by moving

outward along the spiral to integration testing, where the focus is on the design and

the construction of the software architecture. Taking another turn on outward on

the spiral we encounter validation testing where requirements established as part of

software requirements analysis are validated against the software that has been

constructed. Finally we arrive at system testing, where the software and other

system elements are tested as a whole.

Table given below outlines the tests that were performed on the

system to ensure correctness and unearth errors, which were subsequently

debugged.

Table shows the Tests Conducted on the System

Testing Phase

Objectives

Unit Testing

The various functions within each program and the program

blocks are tested for proper working.

Module Testing

A module is composed of various programs related to that

module. Module testing is done to check the module

functionality and interaction between units within a module.

Integration Testing

Integration testing is done to test the functionality and interfacing

between the modules.

Acceptance Testing

Acceptance testing is done after implementation to check if the

system runs successfully in the environment/site.

Page 75: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 75

� UNIT TESTING

Unit Testing will be done to test field validations, navigation,

functionality of the programs and its block. These tests are applied on various

functions within each program and other critical program blocks. Table given

below gives the outline of three-sample test cases for Unit Testing performed on

the system.

Table Unit Testing – Test Case

Test Case Description

This test case deals with the entering of basic details related with the logged in

administrator. This process takes many inputs. The test case should check for proper

inputs and verify whether the function for validating the inputs is called properly or

not.

Inputs

Details Related with the logged in administrator in a Standard Format.

Expected Outputs

• Alert window for erroneous inputs.

• Confirmation of Successful Completion of basic details entry process.

Actual Test Results

• An alert window was shown whenever the user gave some erroneous data.

• Confirmation of completion of basic details entry was displayed on submission,

implying that the functions were called properly.

� MODULE TESTING

Page 76: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 76

Module Testing will be done to test the interaction between the

various programs within one module. It checks the functionality of each program

with relation to other programs within the same module. It then tests the overall

functionality of each module.

� INTEGRATION TESTING

The major concerns of integration testing are developing an

incremental strategy that will limit the complexity of entire actions among

components as they are added to the system. Developing a component as they are

added to the system, developing an implementation and integration schedules that

will make the modules available when needed, and designing test cases that will

demonstrate the viability of the evolving system. Though each program works

individually they should work after linking them together. This is also referred to

as interfacing. Data may be lost across interface and one module can have adverse

effect on another. Subroutines after linking may not do the desired function

expected by the main routine. Integration testing is a systematic technique for

constructing program structure while at the same time conducting tests to uncover

errors associated with the interface. In the testing, the programs are constructed and

tested in small segments.

� VALIDATION TESTING

This provides the final assurance that the software meets all the

functional, behavioral and performance requirements. The software is completely

assembled as a package. Validation succeeds when the software functions in a

manner in which user wishes. Validation refers to the process of using software in

live environment in order to find errors. During the course of validation the system

failure may occur and sometime the coding has to be hanged according to the

requirement. Thus the feedback from the validation phase generally produces

changes in the software.

Page 77: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 77

Once the application was made of all logical and interface errors,

inputting dummy data ensure that the software developed satisfied all the

requirements of the user. The dummy data is known as test cases.

� OUTPUT TESTING

After performing the validation testing, the next step is output

testing of the proposed system since no system could be useful if it does not

produce the required output in the specific format. Asking the users about the

format of output they required, tests the output generated in two ways. One is on

screen and another is printed format.

The output format on the screen found to be correct a s the

format was designed in the system design phase according to the user needs. For

the hard copy also, the output comes out as the specified requirement by the user.

Hence output testing does not result in any correction in the system.

� ACCEPTANCE TESTING

Acceptance testing (also known as user acceptance testing) is a

type of testing carried out in order to verify if the product is developed as per the

standards and specified criteria and meets all the requirements specified by

customer. This type of testing is generally carried out by a user/customer where the

product is developed externally by another party.

Acceptance testing falls under black box testing methodology

where the user is not very much interested in internal working/coding of the

system, but evaluates the overall functioning of the system and compares it with

the requirements specified by them. User acceptance testing is considered to be one

of the most important testing by user before the system is finally delivered or

handled over to the end user.

Page 78: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 78

Acceptance testing is also known as validation testing, final testing,

QA testing, factory acceptance testing and application testing etc. And in software

engineering, acceptance testing may be carried out at two different levels; one at

the system provider level and another at the end user level (hence called user

acceptance testing, field acceptance testing or end-user testing).

Acceptance test refers to the acceptance of data into the system for

processing. The acceptance test contributes to the consistency and smooth working

of the system. The system under consideration is tested for users at a time for

developing and making changes whenever required.

� SYSTEM TESTING

When a system is developed, it is hoped that it performs

properly. In practice however some errors always occur. The main purpose of

testing and information system is to find the errors and correct them. A successful

test is one which finds an error.

The main objectives of system testing are:

• To ensure during operation the system will perform as per

specifications.

• To make sure that the system meets the requirements during operation.

• To verify that the controls incorporated in the system function as

intended.

• To see that when correct inputs are fed to the system the outputs are

correct.

• To make sure that during operation incorrect input and output will be

deleted.

The scope of a system test should include both manual

operations and computerized. Operation system testing is a comprehensive

Page 79: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 79

evaluation of the programs, manual procedures, computer operations and controls.

System testing is the process of checking if the developed system is working

according to the original objectives and requirements. All testing needs to be

conducted in accordance to the test conditions specified earlier.

7.2 TEST CASES

A specific set of steps and data along with expected results for a

particular test objective. A test case should only test one limited subset of a feature or

functionality.

Computer Arithmetic using modular Arithmetic has used so many such test cases.

Test case

Description Expected Result Pass/Fail

Actual Result

Read operation

1. Enter input file name and Press Enter button

Make sure input.txt exist

Pass Success message print

2. Giving wrong input file name and press Enter button

Make sure error message should display as “file not exist”

Pass Error Message is displayed

3. Read character by character from file

Make sure character should Store as its numerical value not ascii value

Pass character store numeric value in character buffer

4. Check size of buffer is appropriate to store input

Make sure no error message “out of size of buffer” will be displayed

Pass No Error Message is displayed

Page 80: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 80

5 Enter alphabet in input text file as input

Make sure error message should display as “input is not numerical data.”

pass Error Message is displayed

6 Allocate appropriate space from buffer to store data

Make sure error message should be displayed ”allocation is failed”

Pass Error message is displayed

7 Print the input Make sure that input will be printed output file

Pass Printed correctly

Operation 1. Convert decimal into

octal representation Input number will be presented will be as a octal number

Pass Decimal converted into octal number

2. Packing the data Each octal number will be presented as three bits number

Data are packed

3 Represent the number in binary in 2’s complement form

Binary representation of input will be 2’s complement form

Pass Binary representation of number is in 2’s complement form

4 Convert 2’s complement number into decimal number

Number will be present correctly in decimal number

Pass Correctly represented corresponding decimal number

5 Unpack data

Number will be display system representation

pass Data is unpacking

6 Convert octal into decimal representation

Input number will be presented will be as a decimal number

pass octal converted into decimal number

7 Get bit of a specified position

System will return 0 or 1 according whatever at that position

pass Find 0 or 1

8 Get digit of a specified position in buffer

Returning number will be corresponding digit

Pass Return number according to position

Page 81: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 81

9 Perform left shift operation

Large input number perform basic left shift operation

Pass Number is shifted left

10 Perform right shift operation

Large input number perform basic right shift operation

Pass Number is shifted right

11 Perform greater than operation on input number

Return non zero if one large number is greater than another number

Pass Return 1

12 Perform less than operation on input number

Return non zero if one large number is less than another number

Pass Return 1

13 Perform equal to operation on input number

Return 0 if one large number is equal to another number

Pass Return 0

14 Convert input number into long int if it is less than 31 bit

Return long int instead of char array

Pass Convert into Long int

15 Convert long int into char array

long int will be represented as character array

Pass LongInt found instead of long int

16 Remove invalid bytes Large number wil be without leading zero

Pass Invalid bytes are removed

17 Remove invalid bits Large number remove leading 0 I its binary representation

Pass Invalid bit are removed

GenerateMod 1. Find the bit length of

input number An integer will return as a bit length

Pass Bit length are returned

2. Find different bit length of moduli which to be generated

Make sure we fill find six integer that will be relatively prime

Pass We find the different relatively prime bit length

3. Generate six long integer of specified bit length

We will find six long integer which all bits are 1

Pass We find six different relatively prime large integer

4. Check each bit of each modulo are 1

Make sure message should display as “correct modulo declared”

Pass No Error Message is displayed

5 Chopping the number into different

Make sure the chopping of number

pass No Error Message is displayed

Page 82: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 82

set of number are correctly done

6 Add all different set of chopping number and modulo operation are performed

Make sure modulo operation are correctly done

Pass Modulo operation are correctly done

7 Check each modulus are relatively prime to each other

Return gcd of these modulus are 1

pass These number are relatively prime

CHINESE REMAINDER OPERATION 1. Check that each

modulo are relatively prime

Make sure gcd that two modulo are 1

Pass Print gcd of that modulo is 1

2. Calculate gcd of each modulo

Make sure gcd are calculated correctly

Pass Gcd are calculated correctly

3 Calculate the inverse of a given large number

Make sure when we multiply number with inverse produce result 1

Pass Inverse are correctly calculated

4 Calculate wr respect to each modulo

Make sure value of wr ia correct or not

Pass Value of wr is correct

5 Calculate the result by mr,wr and inverse

Make sure result are correctly calculated

Pass Result are correctly calculated

ADDITION 1. Read operation are

correctly performed Make sure message should appear “read operation are successfully done”

Pass Print message “read operation are successfully done”

2. Check that bit length of input number are less than 32 or not

Return the bit length of number

Pass Returning correct bit length

3 Check that if bit length less than 32 then call number add1 function

Make sure the addition is performed correctly without recursion

Pass Addition perform without recursion

4 Check that if bit length greater than 32 then cal recursively addition process

Make sure that recursive addition called

Pass Recursive addition is called

5 Check that addition and modulus operation are

Make sure after addition result is less

pass Modular addition are performed

Page 83: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 83

calculating parallel

than equal to their modulus

correctly

6 Check that result are recursively used correctly

Make sure result are used correctly in their previous operation

Pass Recursive operation are performed correctly

7 Check that final result are calculated correctly

Make sure that result will be equal to addition of both input number

pass Result are calculated correctly

SUBTRACTION 1. Read operation are

correctly performed Make sure message should appear “read operation are successfully done”

Pass Print message “read operation are successfully done”

2. Check that bit length of input number are less than 32 or not

Return the bit length of number

Pass Returning correct bit length

3 Check that if bit length less than 32 then call number sub1 function

Make sure the subtraction are performed correctly without recursion

Pass Subtraction perform without recursion

4 Check that if bit length greater than 32 then cal recursively subtraction process

Make sure that recursive subtraction called

Pass Recursive subtraction is called

5 Check that subtraction and modulus operation are calculating parallel

Make sure after subtraction result is less than equal to their modulus

pass Modular subtraction are performed correctly

6 Check that result are recursively used correctly

Make sure result are used correctly in their previous operation

Pass Recursive operation are performed correctly

7 Check that final result are calculated correctly

Make sure that result will be equal to subtraction of one input number from another input number

pass Result are calculated correctly

MULTIPLICATION

Page 84: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 84

1. Read operation are correctly performed

Make sure message should appear “read operation are successfully done”

Pass Print message “read operation are successfully done”

2. Check that bit length of input number are less than 32 or not

Return the bit length of number

Pass Returning correct bit length

3 Check that if bit length less than 32 then call number Mult1 function

Make sure the multiplication are performed correctly without recursion

Pass Multiplication perform without recursion

4 Check that if bit length greater than 32 then cal recursively multiplication process

Make sure that recursive multiplication called

Pass Recursive multiplication is called

5 Check that multiplication and modulus operation are calculating parallel

Make sure after multiplication result is less than equal to their modulus

pass Modular multiplication are performed correctly

6 Check that result are recursively used correctly

Make sure result are used correctly in their previous operation

Pass Recursive operation are performed correctly

7 Check that final result are calculated correctly

Make sure that result will be equal to multiplication of one input number from another input number

pass Result are calculated correctly

DIVISION 1. Read operation are

correctly performed Make sure message should appear “read operation are successfully done”

Pass Print message “read operation are successfully done”

2. Check that bit length of input numer are less than 32 or not

Return the bit length of number

Pass Returning correct bit length

3 Check that if bit length less than 32 then call number dIv1 function

Make sure the division are performed correctly without recursion

Pass Division perform without recursion

4 Check that if bit length greater than 32 then cal recursively division process

Make sure that recursive division called

Pass Recursive division is called

Page 85: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 85

5 Check that division and modulus operation are calculating parallel

Make sure after division result is less than equal to their modulus

pass Modular division are performed correctly

6 Check that result are recursively used correctly

Make sure result are used correctly in their previous operation

Pass Recursive operation are performed correctly

7 Check that final result are calculated correctly

Make sure that result will be equal to division of one input number from another input number

pass Result are calculated correctly

MODULUS 1. Read operation are

correctly performed Make sure message should appear “read operation are successfully done”

Pass Print message “read operation are successfully done”

2. Check that bit length of input number are less than 32 or not

Return the bit length of number

Pass Returning correct bit length

3 Check that if bit length less than 32 then call number Mod1 function

Make sure the modulus are performed correctly without recursion

Pass modulus perform without recursion

4 Check that if bit length greater than 32 then cal recursively modulus process

Make sure that recursive modulus called

Pass Recursive modulus is called

5 Check that division, subtraction and modulus operation are calculating parallel

Make sure after modulus result is less than equal to their modulus

pass Modular modulus are performed correctly

6 Check that result are recursively used correctly

Make sure result are used correctly in their previous operation

Pass Recursive operation are performed correctly

7 Check that final result are calculated correctly

Make sure that result will be equal to modulus of one input number with respect to another input number

pass Result are calculated correctly

POWER

Page 86: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 86

1. Read operation are

correctly performed Make sure message should appear “read operation are successfully done”

Pass Print message “read operation are successfully done”

2 Check that repeated multiplicative operation are done correctly

Make sure result are correctly calculated

pass Modular power are performed correctly

7.3 VALIDATION CHECKS I have use following type of checks/ data validations: Data type Length Constraints Blank field Format Data type: I have use character type for storing integer date type. But it never take character,

alphabet, special symbol. It take only decimal number between 0 to 9

Length:

We perform this operation on large integer. So there is no length limitation of

input number, but length should not greater than size of buffer

Constraints:

In this I am defining type of data, if data is not numeric type then display error with

message.

Blank input file:

Input file should not be blanked. If the input file is blank then it display error

message.

Page 87: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 87

SYSTEM IMPLEMENTATION

Page 88: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 88

8. SYSTEM IMPLEMENTATION A crucial phase in system development is the successful

implementation of the new system design. Implementation includes all those

activities that take place to convert from the old system to the new system. The

new system may be completely new replacing an existing manual or automated

system or it may be major modification to an existing system.

In either case proper implementation becomes necessary so that a

reliable system based on the requirement of the organization can be provided.

Successful implementation may not guarantee improvement in the organization

using the new system, but improper installation will prevent this improvement.

It has been observed that even the best system cannot show good

results if the analysts managing th implementation do not attend every important

detail. This is the area where the system analysts need to work with utmost care.

There are three main aspects of implementation:-

User training

User Manual

Conversion

� User Training

Even well designed system can succeed or fail because of the

way these are operated and used. Therefore the quality of training received by the

personal involved with the system in various capacities helps or hinders and may

even prevent with the system development must know in detail what their roles

will be, how they can make efficient use of the system and what will not do for

them.

An analysis of user training focuses on two factors:-

Page 89: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 89

User capabilities

Nature of the proposed system

When a system is developed then only the developer of it knows

its operation. But as the project is being made for a client (organization) and it is to

be used by the employees of that firm, so there is need of user training. As the

system is new for the employees and staff of the cooperation so there is a necessity

to train them because they have to operate the system. For the live demonstration

with the personal contact are very effective. No training is complete without

familiarizing users with simple system.

� User Manual

When a system is developed then only the developer of it knows

its operation. But as the project is being made for a client and it is to be used by the

staffs of that firm, so there is a need of user manual. It is documentation of project

that describes how to operate the system? What are the various modules for

efficient use of the system? How to start the system?

The user manual helps to find out the answers of the queries like:-

How to start the system?

How to make entry?

How to generate reports?

� Conversion

Conversion is the process of the old system to the new one. It

should be accomplished in shortest possible time. Four methods are commonly

used:-

Parallel system

Page 90: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 90

Direct conversion

Pilot system

Phase – in mind

The COMPUTER ARITHMETIC USING MODULAR

ARITHMETIC is being developed with different phases being taken into

mind….the project is developed in different phases starting with the analysis phase

and ends with implementation phase. After implementation phase the maintenance

phase will begin which keeps on going…..

In computer arithmetic following files,class and

function are used.

(1) LongInt.cpp -> It defines a class LongInt which is base class .It

read data and perform some operation on it. Some function are defined in this

class are following LongInt LongInt :: Read(FILE* fp):- -It read input from file, allocate space to it. LongInt LongInt :: SpaceAlloc(const ushort& , const Rep& , uchar* ):-- allocate space to input Void LongInt :: Print():-- print in any format

void LongInt ::PrintBytesL(LongInt*):-- print in bytes format void LongInt :: PrintDec(LongInt &, const uchar&):--print input in decimal format void LongInt :: PrintSMag(LongInt &):--print message void LongInt :: Pack(LongInt & , const uchar*, const uchar&,const ushort&):--packing data uchar * LongInt ::UnPack(LongInt &, ushort):--unpack the data

LongInt LongInt ::DecToTComp(LongInt &):--convert decimal into two complement LongInt LongInt:: TCompToDec():--convert two complement Into decimal LongInt LongInt :: Compact(uchar*, ushort, const Rep& ):-- remove invlid bytes and bits

Page 91: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 91

LongInt LongInt:: Mod2( LongInt & , LongInt &):-- perform modulus of specific form 2n-1 form integer void LongInt :: performmod(LongInt):romova extra bytes/bits

(2) Operation.cpp :-- It defines a class operation .It perform some low level

operation on it. Some function are defined in this class are following

Ushort operation :: bitlength():--return total bitlength of number

void operation ::operator << (ushort):--perform left shift operation on large integer void operation ::operator >> (ushort):--perform right shift operation on large integer uchar operation::Iszero(): --check number is zero or not short operation::operator > (LongInt ):--return 1 if one number is greater than another

short operation :: operator < (LongInt):--return 1 if one number is less than another otherwise 0 short operation ::operator ==(LongInt): --return 0 if two number are equal

long int operation::convertlong():--convert LongInt into long int LongInt operation::convertLongInt(LongInt):--convert long int into LongInt

(3) GenerateMod.cpp:-- It defines a class Generate .It perform generation of six

different modulo and perform mod operation. Some function are defined in this

class are following

LongInt GenerateMod:: Generate(ushort a):--responsible for generate six modulo LongInt Generate:: Mod2( LongInt & , LongInt &):--perform Modulo operation void GenerateMod ::GenerateMod1(LongInt *,LongInt &,LongInt &):--generate the mod

LongInt Generate::chopping(LongInt & ,LongInt &):--perform chopping operation

Page 92: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 92

(4) Basicpeartion.cpp- It defines a class basicoperation .It perform

addition,subtractionand multiplication. Some function are defined in this class

are following

LongInt ModAdd(LongInt,LongInt,LongInt):--perform recursive modular addition

LongInt Add1(LongInt &,LongInt &):--perform addition for less than 32 bit number LongInt operator +(LongInt &):-- for addition LongInt ModSub(LongInt,LongInt,LongInt):--perform recursive subtraction operation LongInt sub1(LongInt &,LongInt &):--perform subtraction operation for less than 32 bit number LongInt operator -(LongInt &):--perform subtraction LongInt ModMult(LongInt &,LongInt &,LongInt &):--perform recursive modular multiplication LongInt mult1(LongInt &x,LongInt &y):--perform multiplication for less than 32 bits number LongInt operator *(LongInt & b): --perform multiplication

LongInt Result(LongInt *,LongInt*):--calculate result

(5) Division.cpp:- It defines a class division .It perform division operation.It

defines following function

LongInt MOddiv(LongInt,LongInt,LongInt):-- perform recursive modular division operation LongInt Div1(LongInt &,LongInt &):--perform division for less than 32 bits number LongInt operator /(LongInt &):-- perform division operation

(6) Modulous.cpp:- It defines a class Modulus .it define following function

LongInt Mod1(LongInt,LongInt,LongInt):-perform modular operation using recursive division and subtraction LongInt Mod2(LongInt &,LongInt &):-- perform mod operation for less than 32 bits number.

Page 93: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 93

LongInt operator %(LongInt &)- perform modulus

(7) Power.cpp-> It defines power class.it defines power function

LongInt Pow1(LongInt &,LongInt &) LongInt pow(LongInt &)

Page 94: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 94

SYSTEM MAINTENANCE

9. SYSTEM MAINTENANCE System maintenance is the modification of a software product

after delivery to correct faults, to improve performance or other attributes, or to

adapt the product to a modified environment. Maintenance is thus a very broad

activity often defined as including all work made on a software system after it

becomes operational.

Maintenance covers large number of activities like the correction

of errors, the enhancement, deletion and addition of capabilities, the adaptation to

changes in data requirements and operation environments, the improvement of

performance, usability, or any other quality attribute. Maintenance accounts for 50-

80 percent of total system development. To put maintenance in its proper

perspective requires considerable skill and experience and is an important and

ongoing aspect of system development. Maintenance demands more orientation

and training than any other programming activities. The environment must

recognize the needs of the maintenance programmer for tools, methods and

training.

Maintenance is done after the successful implementation of the

software and is continued till the product is reengineered or deployed to another

platform. Maintenance is also done based on fixing the problems reported,

changing the interface with other software or hardware enhancing the software.

Page 95: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 95

CONCLUSION

Page 96: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 96

10. CONCLUSION

It is a user-friendly simple algorithmic implementation. All the

suggestions forwarded during the software proposal have been successfully

completed and final threshold of application has been crossed. Some errors were

spotted out during the system testing and were corrected. The system developed for

the given conditions specified by the firm was found working efficiently. The

system is highly flexible and is well efficient to make easy interactions with the

file. The goal of this project to perform operation fastly.It uses very simple number

theory algorithm which is easy to understand. After implementation of this we

may use in various cryptography algorithm for performing operation fast, checking

the computer security and measure the performance of algorithm and security of

system.

Page 97: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 97

SCREEN SHOTS

Page 98: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 98

READ OPERATION

Page 99: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 99

Page 100: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 100

ADDITION OPERATION

Page 101: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 101

SUBTRACTION OPERATION

Page 102: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 102

MULTIPLICATION OPERATION

Page 103: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 103

DIVISION OPERATION

Page 104: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 104

MODULUS OPERATION

Page 105: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 105

POWER OPOEARATION

Page 106: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 106

BIBLIOGRAPHY

Page 107: COMPUTER ARITHMETIC OPERATION USING MODULAR ARITHMETICdspace.cusat.ac.in/jspui/bitstream/123456789/4244/1/C… ·  · 2011-08-09computer arithmetic operation using modular arithmetic

Page | 107

BIBILIOGRAPHY

• D.E. Knuth, Seminumerical Algorithms, vol. 2 of The Art of

Computer Programming, second ed. Addison-Wesley, 1981

• Szabo, N. and Tanaka, R, Residue Arithmetic and its Application to

Computer Technology , MC-Graw-Hill, New York, 1967

• Peter L. Montgomery, Modular Multiplication without trial

Division”Mathmatics of computation”

• R.L. Rivest, A. Shamir, and L. Adleman, “A Method for Obtaining Digital Signatures and Public-Key Cryptosystems,”