Code Duplication    Length = 12-12 lines in 2 locations

src/library/sodium_compat/src/Crypto.php 1 location

@@ 411-422 (lines=12) @@
408
     * @param string $keypair
409
     * @return string
410
     */
411
    public static function box($plaintext, $nonce, $keypair)
412
    {
413
        $c = self::secretbox(
414
            $plaintext,
415
            $nonce,
416
            self::box_beforenm(
417
                self::box_secretkey($keypair),
418
                self::box_publickey($keypair)
419
            )
420
        );
421
        return $c;
422
    }
423
424
    /**
425
     * X25519-XSalsa20-Poly1305 with one ephemeral X25519 keypair.

src/library/sodium_compat/src/Crypto32.php 1 location

@@ 411-422 (lines=12) @@
408
     * @param string $keypair
409
     * @return string
410
     */
411
    public static function box($plaintext, $nonce, $keypair)
412
    {
413
        $c = self::secretbox(
414
            $plaintext,
415
            $nonce,
416
            self::box_beforenm(
417
                self::box_secretkey($keypair),
418
                self::box_publickey($keypair)
419
            )
420
        );
421
        return $c;
422
    }
423
424
    /**
425
     * X25519-XSalsa20-Poly1305 with one ephemeral X25519 keypair.