Skip to content

5l1v3r1/text-shorten

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Text Shortener

This is a text shortener that reduces the length of any string to either 6 or 7 characters. See below for explanation of the algorithm used.

Link

client - https://link-shorten-client-b.web.app/
server - https://link-short-server-b.herokuapp.com/

Algorithm

The algorithm works by dividing the string into a number of segments. We then calculate the ASCII for each segment and then divide by a prime number. The code is converted back to characters

Steps

  • Calculate length of input string
  • Calculate length of each segment by dividing length of string by number of segments
  • Calculate the number of remaining characters by length of string modulo number of segments
  • For each segment, calculate the sum of ASCII codes of each individual segment
  • Divide the sum by a prime number
  • If the result is less than 33, add 33 to the result
  • Convert the resultant code back to character
  • Append the character to the output string
  • If there is a remainder, then perform the above steps and append the result to the output string

Components

The src folder contains the code for both, the client and the server

Client

Built using the React framework
Libraries used:

  • Axios: for network requests

Server

Built using Express framework

Tests

BurhanuddinUdaipurwala ThisIsATestString

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 72.8%
  • HTML 14.7%
  • CSS 12.5%