Code Duplication    Length = 7-7 lines in 3 locations

src/library/sodium_compat/src/Crypto.php 2 locations

@@ 579-585 (lines=7) @@
576
     * @return string
577
     * @throws RangeException
578
     */
579
    public static function box_secretkey($keypair)
580
    {
581
        if (ParagonIE_Sodium_Core_Util::strlen($keypair) !== 64) {
582
            throw new RangeException('Must be ParagonIE_Sodium_Compat::CRYPTO_BOX_KEYPAIRBYTES bytes long.');
583
        }
584
        return ParagonIE_Sodium_Core_Util::substr($keypair, 0, 32);
585
    }
586
587
    /**
588
     * @internal Do not use this directly. Use ParagonIE_Sodium_Compat.
@@ 594-600 (lines=7) @@
591
     * @return string
592
     * @throws RangeException
593
     */
594
    public static function box_publickey($keypair)
595
    {
596
        if (ParagonIE_Sodium_Core_Util::strlen($keypair) !== ParagonIE_Sodium_Compat::CRYPTO_BOX_KEYPAIRBYTES) {
597
            throw new RangeException('Must be ParagonIE_Sodium_Compat::CRYPTO_BOX_KEYPAIRBYTES bytes long.');
598
        }
599
        return ParagonIE_Sodium_Core_Util::substr($keypair, 32, 32);
600
    }
601
602
    /**
603
     * @internal Do not use this directly. Use ParagonIE_Sodium_Compat.

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

@@ 579-585 (lines=7) @@
576
     * @return string
577
     * @throws RangeException
578
     */
579
    public static function box_publickey($keypair)
580
    {
581
        if (ParagonIE_Sodium_Core32_Util::strlen($keypair) !== ParagonIE_Sodium_Compat::CRYPTO_BOX_KEYPAIRBYTES) {
582
            throw new RangeException('Must be ParagonIE_Sodium_Compat::CRYPTO_BOX_KEYPAIRBYTES bytes long.');
583
        }
584
        return ParagonIE_Sodium_Core32_Util::substr($keypair, 32, 32);
585
    }
586
587
    /**
588
     * @internal Do not use this directly. Use ParagonIE_Sodium_Compat.