Details

      Description

      Following suit with the Java Random implementations, it'd be better if we switched CryptoCodec#generateSecureRandom to take a byte[] for parity.

      Also, let's document that this method needs to be thread-safe, which is an important consideration for CryptoCodec implementations.

      1. HADOOP-10713.001.patch
        1 kB
        Andrew Wang
      2. HADOOP-10713.002.patch
        3 kB
        Andrew Wang

        Activity

        Hide
        Andrew Wang added a comment -

        Trivial patch attached. While I was looking at this, I also wondered whether this API should be like SecureRandom#nextBytes(byte[]), taking a byte[], rather than taking an int numBytes and returning a new array. Yi Liu any thoughts? It might save us some allocations.

        Show
        Andrew Wang added a comment - Trivial patch attached. While I was looking at this, I also wondered whether this API should be like SecureRandom#nextBytes(byte[]) , taking a byte[] , rather than taking an int numBytes and returning a new array. Yi Liu any thoughts? It might save us some allocations.
        Hide
        Yi Liu added a comment -

        Great, thanks Andrew Wang, this can save some allocations.
        +1 to use byte[] as parameter.

        Show
        Yi Liu added a comment - Great, thanks Andrew Wang , this can save some allocations. +1 to use byte[] as parameter.
        Hide
        Andrew Wang added a comment -

        Thanks Yi, new patch attached. I went ahead and refactored generateSecureRandom to be more like Random#nextBytes.

        Show
        Andrew Wang added a comment - Thanks Yi, new patch attached. I went ahead and refactored generateSecureRandom to be more like Random#nextBytes.
        Hide
        Charles Lamb added a comment -

        +1

        Show
        Charles Lamb added a comment - +1
        Hide
        Yi Liu added a comment -

        +1, thanks Andrew.

        Show
        Yi Liu added a comment - +1, thanks Andrew.
        Hide
        Yi Liu added a comment -

        Committed to branch.

        Show
        Yi Liu added a comment - Committed to branch.

          People

          • Assignee:
            Andrew Wang
            Reporter:
            Andrew Wang
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development