PRBHA-10: A hashing algorithm in PythonHashing passwords for a websiteHow easy is it to crack this encryption algorithm?PHP password encryption algorithmMy images have secrets A.K.A. the making of aesthetic passwordsMy images have secrets A.K.A. the making of aesthetic passwords V.2Python image encryption security analysis

How bad would a partial hash leak be, realistically?

What are the words for people who cause trouble believing they know better?

Do manufacturers try make their components as close to ideal ones as possible?

Traffic law UK, pedestrians

Why is c4 bad when playing the London against a King's Indian?

Avoiding cliches when writing gods

Pronoun introduced before its antecedent

Can a magnetic field of an object be stronger than its gravity?

How would you say “AKA/as in”?

Can a 2nd-level sorcerer use sorcery points to create a 2nd-level spell slot?

How do photons get into the eyes?

Completing the square to find if quadratic form is positive definite.

Building a road to escape Earth's gravity by making a pyramid on Antartica

Whats the next step after commercial fusion reactors?

What happened to all the nuclear material being smuggled after the fall of the USSR?

How is it possible that Gollum speaks Westron?

Do any instruments not produce overtones?

Company did not petition for visa in a timely manner. Is asking me to work from overseas, but wants me to take a paycut

PhD student with mental health issues and bad performance

How hard would it be to convert a glider into an powered electric aircraft?

Is it legal in the UK for politicians to lie to the public for political gain?

On the Twin Paradox Again

What's the correct term describing the action of sending a brand-new ship out into its first seafaring trip?

C SIGINT signal in Linux



PRBHA-10: A hashing algorithm in Python


Hashing passwords for a websiteHow easy is it to crack this encryption algorithm?PHP password encryption algorithmMy images have secrets A.K.A. the making of aesthetic passwordsMy images have secrets A.K.A. the making of aesthetic passwords V.2Python image encryption security analysis






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








2












$begingroup$


So I've been working on a simple little hashing algorithm for Python that I like to call PRBHA-10 for short, or Pseudo-Random-Based Hash Algorithm. This is a hash algorithm in Python that is meant to be simplistic and secure. As you could see from the title, the algorithm implements a system with seeding the pseudo-random number generator to be able to produce the correct integer values when provided the correct password, therefore enabling the decryption of an encrypted byte sequence or string.



Here's the advantages of my method:



  • The functions are tiny and simple, unlike some hashing methods out there.


  • Despite the simplicity of the algorithm, it is secure due to the generation of large random numbers that scale with the password size.


  • There is no chance of revealing even part of the encrypted string without the full password due to the huge numbers created by the seeded PRNG and multiplication that completely messes up the string if the wrong password is entered.


  • It is fast. I have not done timeits yet, but the functions run in a trivial amount of time to generate their results.


The disadvantages:



  • A somewhat large password is required to ensure security - usually anything over seven characters is completely cryptographically secure.


  • It is vulnerable to the same brute-force attacks that any cryptographic encryption method is vulnerable to.


  • With larger passwords comes greater security, but also a larger hash. The hash size slightly increases with each character added onto the password.


Here's the whole module program, prhba.py:



"""Pseudo-Random Based Hash Algorithm (PRHBA-10) is a simple 
Python cipher that uses the integer representation of a
string, along with taking advantage of the built-in
pseudo-random number generator to be able to securely encrypt
strings and bytearrays.

The algorithm uses the integer representation of byte sequences,
seeding the random number generator using the password to
create a predictable random number for later use, and a special
encoded form to turn any byte sequence into an ASCII string
using only the letters 'aceilnorst'. This is secure due to the
extremely large random number generated ensuring the security
of the result.

The result can be later decrypted using a special algorithm to
decipher the text into a large integer number. Then, the
password is used as a seed to once again get the random number
used earlier in the process. That integer is used to modify
the large integer to be able to get the integer form of the
original string, which can then be converted to a string.

This cipher currently only works in Python due to the specific
random number generation implementation in the `random` module.
"""

import math
import random

__all__ = ["encrypt", "decrypt"]

LETTERS = "aceilnorst"

def to_num(s):
return int.from_bytes(s.encode(), 'little')

def from_num(n):
return n.to_bytes(math.ceil(n.bit_length() / 8), 'little')

def encrypt(data, password):
assert len(password) > 1, "Password length cannot be less than two"
random.seed(to_num(password))
unique_id = to_num(data) * random.getrandbits(len(password))
chunk = []
for digit in str(unique_id):
chunk.append(LETTERS[int(digit)])
return "".join(chunk)

def decrypt(encrypted_data, password):
random.seed(to_num(password))
partnum_digits = []
for char in encrypted_data:
partnum_digits.append(str(LETTERS.index(char)))
partnum = int("".join(partnum_digits))
return from_num(partnum // random.getrandbits(len(password)))


Here's the questions I have:



  • Is it PEP-8 compliant?


  • Are the variable names confusing?


  • Is there any parts that could be improved or further reduced?


  • Do you have any other suggestions?


Thanks in advance!










share|improve this question









$endgroup$


















    2












    $begingroup$


    So I've been working on a simple little hashing algorithm for Python that I like to call PRBHA-10 for short, or Pseudo-Random-Based Hash Algorithm. This is a hash algorithm in Python that is meant to be simplistic and secure. As you could see from the title, the algorithm implements a system with seeding the pseudo-random number generator to be able to produce the correct integer values when provided the correct password, therefore enabling the decryption of an encrypted byte sequence or string.



    Here's the advantages of my method:



    • The functions are tiny and simple, unlike some hashing methods out there.


    • Despite the simplicity of the algorithm, it is secure due to the generation of large random numbers that scale with the password size.


    • There is no chance of revealing even part of the encrypted string without the full password due to the huge numbers created by the seeded PRNG and multiplication that completely messes up the string if the wrong password is entered.


    • It is fast. I have not done timeits yet, but the functions run in a trivial amount of time to generate their results.


    The disadvantages:



    • A somewhat large password is required to ensure security - usually anything over seven characters is completely cryptographically secure.


    • It is vulnerable to the same brute-force attacks that any cryptographic encryption method is vulnerable to.


    • With larger passwords comes greater security, but also a larger hash. The hash size slightly increases with each character added onto the password.


    Here's the whole module program, prhba.py:



    """Pseudo-Random Based Hash Algorithm (PRHBA-10) is a simple 
    Python cipher that uses the integer representation of a
    string, along with taking advantage of the built-in
    pseudo-random number generator to be able to securely encrypt
    strings and bytearrays.

    The algorithm uses the integer representation of byte sequences,
    seeding the random number generator using the password to
    create a predictable random number for later use, and a special
    encoded form to turn any byte sequence into an ASCII string
    using only the letters 'aceilnorst'. This is secure due to the
    extremely large random number generated ensuring the security
    of the result.

    The result can be later decrypted using a special algorithm to
    decipher the text into a large integer number. Then, the
    password is used as a seed to once again get the random number
    used earlier in the process. That integer is used to modify
    the large integer to be able to get the integer form of the
    original string, which can then be converted to a string.

    This cipher currently only works in Python due to the specific
    random number generation implementation in the `random` module.
    """

    import math
    import random

    __all__ = ["encrypt", "decrypt"]

    LETTERS = "aceilnorst"

    def to_num(s):
    return int.from_bytes(s.encode(), 'little')

    def from_num(n):
    return n.to_bytes(math.ceil(n.bit_length() / 8), 'little')

    def encrypt(data, password):
    assert len(password) > 1, "Password length cannot be less than two"
    random.seed(to_num(password))
    unique_id = to_num(data) * random.getrandbits(len(password))
    chunk = []
    for digit in str(unique_id):
    chunk.append(LETTERS[int(digit)])
    return "".join(chunk)

    def decrypt(encrypted_data, password):
    random.seed(to_num(password))
    partnum_digits = []
    for char in encrypted_data:
    partnum_digits.append(str(LETTERS.index(char)))
    partnum = int("".join(partnum_digits))
    return from_num(partnum // random.getrandbits(len(password)))


    Here's the questions I have:



    • Is it PEP-8 compliant?


    • Are the variable names confusing?


    • Is there any parts that could be improved or further reduced?


    • Do you have any other suggestions?


    Thanks in advance!










    share|improve this question









    $endgroup$














      2












      2








      2





      $begingroup$


      So I've been working on a simple little hashing algorithm for Python that I like to call PRBHA-10 for short, or Pseudo-Random-Based Hash Algorithm. This is a hash algorithm in Python that is meant to be simplistic and secure. As you could see from the title, the algorithm implements a system with seeding the pseudo-random number generator to be able to produce the correct integer values when provided the correct password, therefore enabling the decryption of an encrypted byte sequence or string.



      Here's the advantages of my method:



      • The functions are tiny and simple, unlike some hashing methods out there.


      • Despite the simplicity of the algorithm, it is secure due to the generation of large random numbers that scale with the password size.


      • There is no chance of revealing even part of the encrypted string without the full password due to the huge numbers created by the seeded PRNG and multiplication that completely messes up the string if the wrong password is entered.


      • It is fast. I have not done timeits yet, but the functions run in a trivial amount of time to generate their results.


      The disadvantages:



      • A somewhat large password is required to ensure security - usually anything over seven characters is completely cryptographically secure.


      • It is vulnerable to the same brute-force attacks that any cryptographic encryption method is vulnerable to.


      • With larger passwords comes greater security, but also a larger hash. The hash size slightly increases with each character added onto the password.


      Here's the whole module program, prhba.py:



      """Pseudo-Random Based Hash Algorithm (PRHBA-10) is a simple 
      Python cipher that uses the integer representation of a
      string, along with taking advantage of the built-in
      pseudo-random number generator to be able to securely encrypt
      strings and bytearrays.

      The algorithm uses the integer representation of byte sequences,
      seeding the random number generator using the password to
      create a predictable random number for later use, and a special
      encoded form to turn any byte sequence into an ASCII string
      using only the letters 'aceilnorst'. This is secure due to the
      extremely large random number generated ensuring the security
      of the result.

      The result can be later decrypted using a special algorithm to
      decipher the text into a large integer number. Then, the
      password is used as a seed to once again get the random number
      used earlier in the process. That integer is used to modify
      the large integer to be able to get the integer form of the
      original string, which can then be converted to a string.

      This cipher currently only works in Python due to the specific
      random number generation implementation in the `random` module.
      """

      import math
      import random

      __all__ = ["encrypt", "decrypt"]

      LETTERS = "aceilnorst"

      def to_num(s):
      return int.from_bytes(s.encode(), 'little')

      def from_num(n):
      return n.to_bytes(math.ceil(n.bit_length() / 8), 'little')

      def encrypt(data, password):
      assert len(password) > 1, "Password length cannot be less than two"
      random.seed(to_num(password))
      unique_id = to_num(data) * random.getrandbits(len(password))
      chunk = []
      for digit in str(unique_id):
      chunk.append(LETTERS[int(digit)])
      return "".join(chunk)

      def decrypt(encrypted_data, password):
      random.seed(to_num(password))
      partnum_digits = []
      for char in encrypted_data:
      partnum_digits.append(str(LETTERS.index(char)))
      partnum = int("".join(partnum_digits))
      return from_num(partnum // random.getrandbits(len(password)))


      Here's the questions I have:



      • Is it PEP-8 compliant?


      • Are the variable names confusing?


      • Is there any parts that could be improved or further reduced?


      • Do you have any other suggestions?


      Thanks in advance!










      share|improve this question









      $endgroup$




      So I've been working on a simple little hashing algorithm for Python that I like to call PRBHA-10 for short, or Pseudo-Random-Based Hash Algorithm. This is a hash algorithm in Python that is meant to be simplistic and secure. As you could see from the title, the algorithm implements a system with seeding the pseudo-random number generator to be able to produce the correct integer values when provided the correct password, therefore enabling the decryption of an encrypted byte sequence or string.



      Here's the advantages of my method:



      • The functions are tiny and simple, unlike some hashing methods out there.


      • Despite the simplicity of the algorithm, it is secure due to the generation of large random numbers that scale with the password size.


      • There is no chance of revealing even part of the encrypted string without the full password due to the huge numbers created by the seeded PRNG and multiplication that completely messes up the string if the wrong password is entered.


      • It is fast. I have not done timeits yet, but the functions run in a trivial amount of time to generate their results.


      The disadvantages:



      • A somewhat large password is required to ensure security - usually anything over seven characters is completely cryptographically secure.


      • It is vulnerable to the same brute-force attacks that any cryptographic encryption method is vulnerable to.


      • With larger passwords comes greater security, but also a larger hash. The hash size slightly increases with each character added onto the password.


      Here's the whole module program, prhba.py:



      """Pseudo-Random Based Hash Algorithm (PRHBA-10) is a simple 
      Python cipher that uses the integer representation of a
      string, along with taking advantage of the built-in
      pseudo-random number generator to be able to securely encrypt
      strings and bytearrays.

      The algorithm uses the integer representation of byte sequences,
      seeding the random number generator using the password to
      create a predictable random number for later use, and a special
      encoded form to turn any byte sequence into an ASCII string
      using only the letters 'aceilnorst'. This is secure due to the
      extremely large random number generated ensuring the security
      of the result.

      The result can be later decrypted using a special algorithm to
      decipher the text into a large integer number. Then, the
      password is used as a seed to once again get the random number
      used earlier in the process. That integer is used to modify
      the large integer to be able to get the integer form of the
      original string, which can then be converted to a string.

      This cipher currently only works in Python due to the specific
      random number generation implementation in the `random` module.
      """

      import math
      import random

      __all__ = ["encrypt", "decrypt"]

      LETTERS = "aceilnorst"

      def to_num(s):
      return int.from_bytes(s.encode(), 'little')

      def from_num(n):
      return n.to_bytes(math.ceil(n.bit_length() / 8), 'little')

      def encrypt(data, password):
      assert len(password) > 1, "Password length cannot be less than two"
      random.seed(to_num(password))
      unique_id = to_num(data) * random.getrandbits(len(password))
      chunk = []
      for digit in str(unique_id):
      chunk.append(LETTERS[int(digit)])
      return "".join(chunk)

      def decrypt(encrypted_data, password):
      random.seed(to_num(password))
      partnum_digits = []
      for char in encrypted_data:
      partnum_digits.append(str(LETTERS.index(char)))
      partnum = int("".join(partnum_digits))
      return from_num(partnum // random.getrandbits(len(password)))


      Here's the questions I have:



      • Is it PEP-8 compliant?


      • Are the variable names confusing?


      • Is there any parts that could be improved or further reduced?


      • Do you have any other suggestions?


      Thanks in advance!







      python python-3.x random cryptography






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 8 hours ago









      connectyourchargerconnectyourcharger

      1908




      1908




















          1 Answer
          1






          active

          oldest

          votes


















          3












          $begingroup$

          Don’t roll your own encryption. It takes a team of experts to develop new secure encryption methods, and even they can get it wrong from time to time.



          Huge hole in your DIY encryption:



          If I use a 2-character password, I might naïvely expect I’d have $62^2$ possible passwords that I can encrypt the data with. I’d be really shocked when it turns out there are only 4.



          random.getrandbits(len(password))


          generates 2 random bits, for $2^2$ possible values to multiply to_num(data) by. Only 4 possibilities is a lot easier to attack than $62^2$ different possibilities!



          And one of those possibilities ... all bits zero ... destroys all the data you want to encode. So we’re down to actually only 3 possible numbers to test to reverse the encryption.




          Any encryption mechanism worth its salt uses a salt (initial random data) to prevent the same message with the same password from being encrypted as the same text.




          Code improvements: use generator expressions. Eg)



          chunk = []
          for digit in str(unique_id):
          chunk.append(LETTERS[int(digit)])
          return "".join(chunk)


          would be more efficient rewritten as:



          return "".join(LETTERS[int(digit)] for digit in str(unique_id))


          The chunk list is never created in memory; instead, the join method pulls items one at a time from the generator expression.




          Finally, don’t roll your own encryption.






          share|improve this answer









          $endgroup$












          • $begingroup$
            Thanks for the suggestion. I agree, it is lacking in the department of small passwords. That's why I said it needs sufficiently large passwords in the post. This was just something I was playing with - I don't actually expect it to compete with any standard cryptographic methods.
            $endgroup$
            – connectyourcharger
            6 hours ago










          • $begingroup$
            You missed the point. A two character pass phrase creates a two bit encryption key; an 10 character pass phrase creates a 10 bit encryption key!!!
            $endgroup$
            – AJNeufeld
            4 hours ago










          • $begingroup$
            No, yes, I understand that. It's a limitation I've been trying to get past.
            $endgroup$
            – connectyourcharger
            4 hours ago











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "196"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f221499%2fprbha-10-a-hashing-algorithm-in-python%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          3












          $begingroup$

          Don’t roll your own encryption. It takes a team of experts to develop new secure encryption methods, and even they can get it wrong from time to time.



          Huge hole in your DIY encryption:



          If I use a 2-character password, I might naïvely expect I’d have $62^2$ possible passwords that I can encrypt the data with. I’d be really shocked when it turns out there are only 4.



          random.getrandbits(len(password))


          generates 2 random bits, for $2^2$ possible values to multiply to_num(data) by. Only 4 possibilities is a lot easier to attack than $62^2$ different possibilities!



          And one of those possibilities ... all bits zero ... destroys all the data you want to encode. So we’re down to actually only 3 possible numbers to test to reverse the encryption.




          Any encryption mechanism worth its salt uses a salt (initial random data) to prevent the same message with the same password from being encrypted as the same text.




          Code improvements: use generator expressions. Eg)



          chunk = []
          for digit in str(unique_id):
          chunk.append(LETTERS[int(digit)])
          return "".join(chunk)


          would be more efficient rewritten as:



          return "".join(LETTERS[int(digit)] for digit in str(unique_id))


          The chunk list is never created in memory; instead, the join method pulls items one at a time from the generator expression.




          Finally, don’t roll your own encryption.






          share|improve this answer









          $endgroup$












          • $begingroup$
            Thanks for the suggestion. I agree, it is lacking in the department of small passwords. That's why I said it needs sufficiently large passwords in the post. This was just something I was playing with - I don't actually expect it to compete with any standard cryptographic methods.
            $endgroup$
            – connectyourcharger
            6 hours ago










          • $begingroup$
            You missed the point. A two character pass phrase creates a two bit encryption key; an 10 character pass phrase creates a 10 bit encryption key!!!
            $endgroup$
            – AJNeufeld
            4 hours ago










          • $begingroup$
            No, yes, I understand that. It's a limitation I've been trying to get past.
            $endgroup$
            – connectyourcharger
            4 hours ago















          3












          $begingroup$

          Don’t roll your own encryption. It takes a team of experts to develop new secure encryption methods, and even they can get it wrong from time to time.



          Huge hole in your DIY encryption:



          If I use a 2-character password, I might naïvely expect I’d have $62^2$ possible passwords that I can encrypt the data with. I’d be really shocked when it turns out there are only 4.



          random.getrandbits(len(password))


          generates 2 random bits, for $2^2$ possible values to multiply to_num(data) by. Only 4 possibilities is a lot easier to attack than $62^2$ different possibilities!



          And one of those possibilities ... all bits zero ... destroys all the data you want to encode. So we’re down to actually only 3 possible numbers to test to reverse the encryption.




          Any encryption mechanism worth its salt uses a salt (initial random data) to prevent the same message with the same password from being encrypted as the same text.




          Code improvements: use generator expressions. Eg)



          chunk = []
          for digit in str(unique_id):
          chunk.append(LETTERS[int(digit)])
          return "".join(chunk)


          would be more efficient rewritten as:



          return "".join(LETTERS[int(digit)] for digit in str(unique_id))


          The chunk list is never created in memory; instead, the join method pulls items one at a time from the generator expression.




          Finally, don’t roll your own encryption.






          share|improve this answer









          $endgroup$












          • $begingroup$
            Thanks for the suggestion. I agree, it is lacking in the department of small passwords. That's why I said it needs sufficiently large passwords in the post. This was just something I was playing with - I don't actually expect it to compete with any standard cryptographic methods.
            $endgroup$
            – connectyourcharger
            6 hours ago










          • $begingroup$
            You missed the point. A two character pass phrase creates a two bit encryption key; an 10 character pass phrase creates a 10 bit encryption key!!!
            $endgroup$
            – AJNeufeld
            4 hours ago










          • $begingroup$
            No, yes, I understand that. It's a limitation I've been trying to get past.
            $endgroup$
            – connectyourcharger
            4 hours ago













          3












          3








          3





          $begingroup$

          Don’t roll your own encryption. It takes a team of experts to develop new secure encryption methods, and even they can get it wrong from time to time.



          Huge hole in your DIY encryption:



          If I use a 2-character password, I might naïvely expect I’d have $62^2$ possible passwords that I can encrypt the data with. I’d be really shocked when it turns out there are only 4.



          random.getrandbits(len(password))


          generates 2 random bits, for $2^2$ possible values to multiply to_num(data) by. Only 4 possibilities is a lot easier to attack than $62^2$ different possibilities!



          And one of those possibilities ... all bits zero ... destroys all the data you want to encode. So we’re down to actually only 3 possible numbers to test to reverse the encryption.




          Any encryption mechanism worth its salt uses a salt (initial random data) to prevent the same message with the same password from being encrypted as the same text.




          Code improvements: use generator expressions. Eg)



          chunk = []
          for digit in str(unique_id):
          chunk.append(LETTERS[int(digit)])
          return "".join(chunk)


          would be more efficient rewritten as:



          return "".join(LETTERS[int(digit)] for digit in str(unique_id))


          The chunk list is never created in memory; instead, the join method pulls items one at a time from the generator expression.




          Finally, don’t roll your own encryption.






          share|improve this answer









          $endgroup$



          Don’t roll your own encryption. It takes a team of experts to develop new secure encryption methods, and even they can get it wrong from time to time.



          Huge hole in your DIY encryption:



          If I use a 2-character password, I might naïvely expect I’d have $62^2$ possible passwords that I can encrypt the data with. I’d be really shocked when it turns out there are only 4.



          random.getrandbits(len(password))


          generates 2 random bits, for $2^2$ possible values to multiply to_num(data) by. Only 4 possibilities is a lot easier to attack than $62^2$ different possibilities!



          And one of those possibilities ... all bits zero ... destroys all the data you want to encode. So we’re down to actually only 3 possible numbers to test to reverse the encryption.




          Any encryption mechanism worth its salt uses a salt (initial random data) to prevent the same message with the same password from being encrypted as the same text.




          Code improvements: use generator expressions. Eg)



          chunk = []
          for digit in str(unique_id):
          chunk.append(LETTERS[int(digit)])
          return "".join(chunk)


          would be more efficient rewritten as:



          return "".join(LETTERS[int(digit)] for digit in str(unique_id))


          The chunk list is never created in memory; instead, the join method pulls items one at a time from the generator expression.




          Finally, don’t roll your own encryption.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 6 hours ago









          AJNeufeldAJNeufeld

          7,8871725




          7,8871725











          • $begingroup$
            Thanks for the suggestion. I agree, it is lacking in the department of small passwords. That's why I said it needs sufficiently large passwords in the post. This was just something I was playing with - I don't actually expect it to compete with any standard cryptographic methods.
            $endgroup$
            – connectyourcharger
            6 hours ago










          • $begingroup$
            You missed the point. A two character pass phrase creates a two bit encryption key; an 10 character pass phrase creates a 10 bit encryption key!!!
            $endgroup$
            – AJNeufeld
            4 hours ago










          • $begingroup$
            No, yes, I understand that. It's a limitation I've been trying to get past.
            $endgroup$
            – connectyourcharger
            4 hours ago
















          • $begingroup$
            Thanks for the suggestion. I agree, it is lacking in the department of small passwords. That's why I said it needs sufficiently large passwords in the post. This was just something I was playing with - I don't actually expect it to compete with any standard cryptographic methods.
            $endgroup$
            – connectyourcharger
            6 hours ago










          • $begingroup$
            You missed the point. A two character pass phrase creates a two bit encryption key; an 10 character pass phrase creates a 10 bit encryption key!!!
            $endgroup$
            – AJNeufeld
            4 hours ago










          • $begingroup$
            No, yes, I understand that. It's a limitation I've been trying to get past.
            $endgroup$
            – connectyourcharger
            4 hours ago















          $begingroup$
          Thanks for the suggestion. I agree, it is lacking in the department of small passwords. That's why I said it needs sufficiently large passwords in the post. This was just something I was playing with - I don't actually expect it to compete with any standard cryptographic methods.
          $endgroup$
          – connectyourcharger
          6 hours ago




          $begingroup$
          Thanks for the suggestion. I agree, it is lacking in the department of small passwords. That's why I said it needs sufficiently large passwords in the post. This was just something I was playing with - I don't actually expect it to compete with any standard cryptographic methods.
          $endgroup$
          – connectyourcharger
          6 hours ago












          $begingroup$
          You missed the point. A two character pass phrase creates a two bit encryption key; an 10 character pass phrase creates a 10 bit encryption key!!!
          $endgroup$
          – AJNeufeld
          4 hours ago




          $begingroup$
          You missed the point. A two character pass phrase creates a two bit encryption key; an 10 character pass phrase creates a 10 bit encryption key!!!
          $endgroup$
          – AJNeufeld
          4 hours ago












          $begingroup$
          No, yes, I understand that. It's a limitation I've been trying to get past.
          $endgroup$
          – connectyourcharger
          4 hours ago




          $begingroup$
          No, yes, I understand that. It's a limitation I've been trying to get past.
          $endgroup$
          – connectyourcharger
          4 hours ago

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Code Review Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          Use MathJax to format equations. MathJax reference.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f221499%2fprbha-10-a-hashing-algorithm-in-python%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Invision Community Contents History See also References External links Navigation menuProprietaryinvisioncommunity.comIPS Community ForumsIPS Community Forumsthis blog entry"License Changes, IP.Board 3.4, and the Future""Interview -- Matt Mecham of Ibforums""CEO Invision Power Board, Matt Mecham Is a Liar, Thief!"IPB License Explanation 1.3, 1.3.1, 2.0, and 2.1ArchivedSecurity Fixes, Updates And Enhancements For IPB 1.3.1Archived"New Demo Accounts - Invision Power Services"the original"New Default Skin"the original"Invision Power Board 3.0.0 and Applications Released"the original"Archived copy"the original"Perpetual licenses being done away with""Release Notes - Invision Power Services""Introducing: IPS Community Suite 4!"Invision Community Release Notes

          Canceling a color specificationRandomly assigning color to Graphics3D objects?Default color for Filling in Mathematica 9Coloring specific elements of sets with a prime modified order in an array plotHow to pick a color differing significantly from the colors already in a given color list?Detection of the text colorColor numbers based on their valueCan color schemes for use with ColorData include opacity specification?My dynamic color schemes

          Ласкавець круглолистий Зміст Опис | Поширення | Галерея | Примітки | Посилання | Навігаційне меню58171138361-22960890446Bupleurum rotundifoliumEuro+Med PlantbasePlants of the World Online — Kew ScienceGermplasm Resources Information Network (GRIN)Ласкавецькн. VI : Літери Ком — Левиправивши або дописавши її