6 kyu

Basic Encryption

797 of 3,306Tandyman

Description:

The most basic encryption method is to map a char to another char by a certain math rule. Because every char has an ASCII value, we can manipulate this value with a simple math expression. For example 'a' + 1 would give us 'b', because 'a' value is 97 and 'b' value is 98.

You will need to write a method which does exactly that -

get a string as text and an int as the rule of manipulation, and should return encrypted text. for example:

encrypt("a",1) = "b"

Full ascii table is used on our question (256 chars) - so 0-255 are the valid values.

If the value exceeds 255, it should 'wrap'. ie. if the value is 345 it should wrap to 89.

Good luck.

Mathematics
Strings
Ciphers

Stats:

CreatedDec 27, 2016
PublishedDec 27, 2016
Warriors Trained6145
Total Skips583
Total Code Submissions26968
Total Times Completed3306
Java Completions649
JavaScript Completions797
C++ Completions916
Python Completions773
Swift Completions96
C# Completions153
F# Completions42
Total Stars107
% of votes with a positive feedback rating87% of 675
Total "Very Satisfied" Votes525
Total "Somewhat Satisfied" Votes118
Total "Not Satisfied" Votes32
Total Rank Assessments10
Average Assessed Rank
6 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • Tandyman Avatar
  • janitormeir Avatar
  • werner33 Avatar
  • kazk Avatar
  • kleidemos Avatar
  • thefern Avatar
  • user4912975 Avatar
  • SmithG Avatar
  • Voile Avatar
  • Souzooka Avatar
  • yLaWy Avatar
Ad